From 202e7685667d6a3885d43064b28e8c8188b71ede Mon Sep 17 00:00:00 2001 From: STAM Date: Sat, 10 Aug 2024 21:36:22 +0300 Subject: [PATCH] kaniko migrated to pip package --- .../roles/atlassian.bitbucket/files/Makefile | 6 +- .../atlassian.bitbucket/files/kaniko-build.py | 194 ----------------- .../roles/atlassian.jira/files/Makefile | 6 +- .../atlassian.jira/files/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php70/ad/Makefile | 6 +- .../files/php70/ad/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php70/ldap/Makefile | 6 +- .../files/php70/ldap/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php70/main/Makefile | 6 +- .../files/php70/main/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php71/ad/Makefile | 6 +- .../files/php71/ad/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php71/ldap/Makefile | 6 +- .../files/php71/ldap/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php71/main/Makefile | 6 +- .../files/php71/main/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php72/ad/Makefile | 6 +- .../files/php72/ad/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php72/ldap/Makefile | 6 +- .../files/php72/ldap/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php72/main/Makefile | 6 +- .../files/php72/main/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php74/ad/Makefile | 6 +- .../files/php74/ad/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php74/ldap/Makefile | 6 +- .../files/php74/ldap/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php74/main/Makefile | 6 +- .../files/php74/main/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php81/ad/Makefile | 6 +- .../files/php81/ad/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php81/ldap/Makefile | 6 +- .../files/php81/ldap/kaniko-build.py | 194 ----------------- .../gurock.testrail/files/php81/main/Makefile | 6 +- .../files/php81/main/kaniko-build.py | 194 ----------------- bin/kaniko/_deploy.py | 2 +- bin/kaniko/kaniko-build.py | 196 ------------------ bin/kaniko/requirements.txt | 1 + linux/advanced/mattermost/Makefile | 6 +- linux/advanced/mattermost/kaniko-build.py | 196 ------------------ linux/advanced/mattermost/requirements.txt | 1 + linux/advanced/nextcloud/patched/14/Makefile | 6 +- .../nextcloud/patched/14/kaniko-build.py | 196 ------------------ .../nextcloud/patched/14/requirements.txt | 1 + linux/advanced/nextcloud/patched/15/Makefile | 6 +- .../nextcloud/patched/15/kaniko-build.py | 196 ------------------ .../nextcloud/patched/15/requirements.txt | 1 + linux/advanced/nextcloud/patched/16/Makefile | 6 +- .../nextcloud/patched/16/kaniko-build.py | 196 ------------------ .../nextcloud/patched/16/requirements.txt | 1 + linux/advanced/nextcloud/patched/17/Makefile | 6 +- .../nextcloud/patched/17/kaniko-build.py | 196 ------------------ .../nextcloud/patched/17/requirements.txt | 1 + linux/advanced/nextcloud/patched/18/Makefile | 6 +- .../nextcloud/patched/18/kaniko-build.py | 196 ------------------ .../nextcloud/patched/18/requirements.txt | 1 + linux/advanced/nextcloud/patched/19/Makefile | 6 +- .../nextcloud/patched/19/kaniko-build.py | 196 ------------------ .../nextcloud/patched/19/requirements.txt | 1 + linux/advanced/nextcloud/patched/20/Makefile | 6 +- .../nextcloud/patched/20/kaniko-build.py | 196 ------------------ .../nextcloud/patched/20/requirements.txt | 1 + linux/advanced/nextcloud/patched/21/Makefile | 6 +- .../nextcloud/patched/21/kaniko-build.py | 196 ------------------ .../nextcloud/patched/21/requirements.txt | 1 + linux/advanced/nextcloud/patched/22/Makefile | 6 +- .../nextcloud/patched/22/kaniko-build.py | 196 ------------------ .../nextcloud/patched/22/requirements.txt | 1 + linux/advanced/nextcloud/patched/23/Makefile | 6 +- .../nextcloud/patched/23/kaniko-build.py | 196 ------------------ .../nextcloud/patched/23/requirements.txt | 1 + linux/advanced/nextcloud/patched/24/Makefile | 6 +- .../nextcloud/patched/24/kaniko-build.py | 196 ------------------ .../nextcloud/patched/24/requirements.txt | 1 + linux/advanced/nextcloud/patched/25/Makefile | 6 +- .../nextcloud/patched/25/kaniko-build.py | 196 ------------------ .../nextcloud/patched/25/requirements.txt | 1 + linux/advanced/nextcloud/patched/26/Makefile | 6 +- .../nextcloud/patched/26/kaniko-build.py | 196 ------------------ .../nextcloud/patched/26/requirements.txt | 1 + linux/advanced/nextcloud/patched/27/Makefile | 6 +- .../nextcloud/patched/27/kaniko-build.py | 196 ------------------ .../nextcloud/patched/27/requirements.txt | 1 + linux/advanced/nextcloud/patched/28/Makefile | 6 +- .../nextcloud/patched/28/kaniko-build.py | 196 ------------------ .../nextcloud/patched/28/requirements.txt | 1 + linux/advanced/nextcloud/patched/29/Makefile | 6 +- .../nextcloud/patched/29/kaniko-build.py | 196 ------------------ .../nextcloud/patched/29/requirements.txt | 1 + .../nextcloud/patched/latest/Makefile | 6 +- .../nextcloud/patched/latest/kaniko-build.py | 196 ------------------ .../nextcloud/patched/latest/requirements.txt | 1 + linux/advanced/nextcloud/pure/14/Makefile | 6 +- .../nextcloud/pure/14/kaniko-build.py | 196 ------------------ .../nextcloud/pure/14/requirements.txt | 1 + linux/advanced/nextcloud/pure/15/Makefile | 6 +- .../nextcloud/pure/15/kaniko-build.py | 196 ------------------ .../nextcloud/pure/15/requirements.txt | 1 + linux/advanced/nextcloud/pure/16/Makefile | 6 +- .../nextcloud/pure/16/kaniko-build.py | 196 ------------------ .../nextcloud/pure/16/requirements.txt | 1 + linux/advanced/nextcloud/pure/17/Makefile | 6 +- .../nextcloud/pure/17/kaniko-build.py | 196 ------------------ .../nextcloud/pure/17/requirements.txt | 1 + linux/advanced/nextcloud/pure/18/Makefile | 6 +- .../nextcloud/pure/18/kaniko-build.py | 196 ------------------ .../nextcloud/pure/18/requirements.txt | 1 + linux/advanced/nextcloud/pure/19/Makefile | 6 +- .../nextcloud/pure/19/kaniko-build.py | 196 ------------------ .../nextcloud/pure/19/requirements.txt | 1 + linux/advanced/nextcloud/pure/20/Makefile | 6 +- .../nextcloud/pure/20/kaniko-build.py | 196 ------------------ .../nextcloud/pure/20/requirements.txt | 1 + linux/advanced/nextcloud/pure/21/Makefile | 6 +- .../nextcloud/pure/21/kaniko-build.py | 196 ------------------ .../nextcloud/pure/21/requirements.txt | 1 + linux/advanced/nextcloud/pure/22/Makefile | 6 +- .../nextcloud/pure/22/kaniko-build.py | 196 ------------------ .../nextcloud/pure/22/requirements.txt | 1 + linux/advanced/nextcloud/pure/23/Makefile | 6 +- .../nextcloud/pure/23/kaniko-build.py | 196 ------------------ .../nextcloud/pure/23/requirements.txt | 1 + linux/advanced/nextcloud/pure/24/Makefile | 6 +- .../nextcloud/pure/24/kaniko-build.py | 196 ------------------ .../nextcloud/pure/24/requirements.txt | 1 + linux/advanced/nextcloud/pure/25/Makefile | 6 +- .../nextcloud/pure/25/kaniko-build.py | 196 ------------------ .../nextcloud/pure/25/requirements.txt | 1 + linux/advanced/nextcloud/pure/26/Makefile | 6 +- .../nextcloud/pure/26/kaniko-build.py | 196 ------------------ .../nextcloud/pure/26/requirements.txt | 1 + linux/advanced/nextcloud/pure/27/Makefile | 6 +- .../nextcloud/pure/27/kaniko-build.py | 196 ------------------ .../nextcloud/pure/27/requirements.txt | 1 + linux/advanced/nextcloud/pure/28/Makefile | 6 +- .../nextcloud/pure/28/kaniko-build.py | 196 ------------------ .../nextcloud/pure/28/requirements.txt | 1 + linux/advanced/nextcloud/pure/29/Makefile | 6 +- .../nextcloud/pure/29/kaniko-build.py | 196 ------------------ .../nextcloud/pure/29/requirements.txt | 1 + linux/advanced/nextcloud/pure/latest/Makefile | 6 +- .../nextcloud/pure/latest/kaniko-build.py | 196 ------------------ .../nextcloud/pure/latest/requirements.txt | 1 + linux/advanced/python/develop/2.7/Makefile | 6 +- .../python/develop/2.7/kaniko-build.py | 196 ------------------ .../python/develop/2.7/requirements.txt | 1 + linux/advanced/python/develop/3.10/Makefile | 6 +- .../python/develop/3.10/kaniko-build.py | 196 ------------------ .../python/develop/3.10/requirements.txt | 1 + linux/advanced/python/develop/3.11/Makefile | 6 +- .../python/develop/3.11/kaniko-build.py | 196 ------------------ .../python/develop/3.11/requirements.txt | 1 + linux/advanced/python/develop/3.12/Makefile | 6 +- .../python/develop/3.12/kaniko-build.py | 196 ------------------ .../python/develop/3.12/requirements.txt | 1 + linux/advanced/python/develop/3.13/Makefile | 6 +- .../python/develop/3.13/kaniko-build.py | 196 ------------------ .../python/develop/3.13/requirements.txt | 1 + linux/advanced/python/develop/3.6/Makefile | 6 +- .../python/develop/3.6/kaniko-build.py | 196 ------------------ .../python/develop/3.6/requirements.txt | 1 + linux/advanced/python/develop/3.7/Makefile | 6 +- .../python/develop/3.7/kaniko-build.py | 196 ------------------ .../python/develop/3.7/requirements.txt | 1 + linux/advanced/python/develop/3.8/Makefile | 6 +- .../python/develop/3.8/kaniko-build.py | 196 ------------------ .../python/develop/3.8/requirements.txt | 1 + linux/advanced/python/develop/3.9/Makefile | 6 +- .../python/develop/3.9/kaniko-build.py | 196 ------------------ .../python/develop/3.9/requirements.txt | 1 + linux/advanced/python/main/2.7/Makefile | 6 +- .../advanced/python/main/2.7/kaniko-build.py | 196 ------------------ .../advanced/python/main/2.7/requirements.txt | 1 + linux/advanced/python/main/3.10/Makefile | 6 +- .../advanced/python/main/3.10/kaniko-build.py | 196 ------------------ .../python/main/3.10/requirements.txt | 1 + linux/advanced/python/main/3.11/Makefile | 6 +- .../advanced/python/main/3.11/kaniko-build.py | 196 ------------------ .../python/main/3.11/requirements.txt | 1 + linux/advanced/python/main/3.12/Makefile | 6 +- .../advanced/python/main/3.12/kaniko-build.py | 196 ------------------ .../python/main/3.12/requirements.txt | 1 + linux/advanced/python/main/3.13/Makefile | 6 +- .../advanced/python/main/3.13/kaniko-build.py | 196 ------------------ .../python/main/3.13/requirements.txt | 1 + linux/advanced/python/main/3.6/Makefile | 6 +- .../advanced/python/main/3.6/kaniko-build.py | 196 ------------------ .../advanced/python/main/3.6/requirements.txt | 1 + linux/advanced/python/main/3.7/Makefile | 6 +- .../advanced/python/main/3.7/kaniko-build.py | 196 ------------------ .../advanced/python/main/3.7/requirements.txt | 1 + linux/advanced/python/main/3.8/Makefile | 6 +- .../advanced/python/main/3.8/kaniko-build.py | 196 ------------------ .../advanced/python/main/3.8/requirements.txt | 1 + linux/advanced/python/main/3.9/Makefile | 6 +- .../advanced/python/main/3.9/kaniko-build.py | 196 ------------------ .../advanced/python/main/3.9/requirements.txt | 1 + linux/advanced/redash/Makefile | 6 +- linux/advanced/sentry/latest/Makefile | 6 +- linux/advanced/sentry/latest/kaniko-build.py | 196 ------------------ linux/advanced/sentry/latest/requirements.txt | 1 + linux/advanced/teamcity/server/Makefile | 6 +- .../advanced/teamcity/server/kaniko-build.py | 196 ------------------ .../advanced/teamcity/server/requirements.txt | 1 + .../advanced/vscode-server/amxx/1.10/Makefile | 6 +- .../vscode-server/amxx/1.10/kaniko-build.py | 196 ------------------ .../vscode-server/amxx/1.10/requirements.txt | 1 + .../advanced/vscode-server/amxx/1.9/Makefile | 6 +- .../vscode-server/amxx/1.9/kaniko-build.py | 196 ------------------ .../vscode-server/amxx/1.9/requirements.txt | 1 + linux/advanced/vscode-server/android/Makefile | 6 +- .../vscode-server/android/kaniko-build.py | 196 ------------------ .../vscode-server/android/requirements.txt | 1 + linux/advanced/vscode-server/cpp/Makefile | 6 +- .../vscode-server/cpp/kaniko-build.py | 196 ------------------ .../vscode-server/cpp/requirements.txt | 1 + linux/advanced/vscode-server/devops/Makefile | 6 +- .../vscode-server/devops/kaniko-build.py | 196 ------------------ .../vscode-server/devops/requirements.txt | 1 + linux/advanced/vscode-server/docker/Makefile | 6 +- .../vscode-server/docker/kaniko-build.py | 196 ------------------ .../vscode-server/docker/requirements.txt | 1 + .../vscode-server/dotnet-full/Makefile | 6 +- .../vscode-server/dotnet-full/kaniko-build.py | 196 ------------------ .../dotnet-full/requirements.txt | 1 + linux/advanced/vscode-server/dotnet/Makefile | 6 +- .../vscode-server/dotnet/kaniko-build.py | 196 ------------------ .../vscode-server/dotnet/requirements.txt | 1 + linux/advanced/vscode-server/latest/Makefile | 6 +- .../vscode-server/latest/kaniko-build.py | 196 ------------------ .../vscode-server/latest/requirements.txt | 1 + linux/advanced/vscode-server/mono/Makefile | 6 +- .../vscode-server/mono/kaniko-build.py | 196 ------------------ .../vscode-server/mono/requirements.txt | 1 + linux/advanced/zabbix/3.0/agent/Makefile | 6 +- .../advanced/zabbix/3.0/agent/kaniko-build.py | 196 ------------------ .../zabbix/3.0/agent/requirements.txt | 1 + .../advanced/zabbix/3.0/java-gateway/Makefile | 6 +- .../zabbix/3.0/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/3.0/java-gateway/requirements.txt | 1 + .../advanced/zabbix/3.0/proxy-mysql/Makefile | 6 +- .../zabbix/3.0/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/3.0/proxy-mysql/requirements.txt | 1 + .../zabbix/3.0/proxy-sqlite3/Makefile | 6 +- .../zabbix/3.0/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/3.0/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/3.0/server-mysql/Makefile | 6 +- .../zabbix/3.0/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/3.0/server-mysql/requirements.txt | 1 + .../advanced/zabbix/3.0/server-pgsql/Makefile | 6 +- .../zabbix/3.0/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/3.0/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/3.0/snmptraps/Makefile | 6 +- .../zabbix/3.0/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/3.0/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/3.0/web-mysql/Makefile | 6 +- .../zabbix/3.0/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/3.0/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/3.0/web-pgsql/Makefile | 6 +- .../zabbix/3.0/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/3.0/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/4.0/agent/Makefile | 6 +- .../advanced/zabbix/4.0/agent/kaniko-build.py | 196 ------------------ .../zabbix/4.0/agent/requirements.txt | 1 + .../advanced/zabbix/4.0/java-gateway/Makefile | 6 +- .../zabbix/4.0/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/4.0/java-gateway/requirements.txt | 1 + .../advanced/zabbix/4.0/proxy-mysql/Makefile | 6 +- .../zabbix/4.0/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/4.0/proxy-mysql/requirements.txt | 1 + .../zabbix/4.0/proxy-sqlite3/Makefile | 6 +- .../zabbix/4.0/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/4.0/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/4.0/server-mysql/Makefile | 6 +- .../zabbix/4.0/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/4.0/server-mysql/requirements.txt | 1 + .../advanced/zabbix/4.0/server-pgsql/Makefile | 6 +- .../zabbix/4.0/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/4.0/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/4.0/snmptraps/Makefile | 6 +- .../zabbix/4.0/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/4.0/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/4.0/web-mysql/Makefile | 6 +- .../zabbix/4.0/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/4.0/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/4.0/web-pgsql/Makefile | 6 +- .../zabbix/4.0/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/4.0/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/5.0/agent/Makefile | 6 +- .../advanced/zabbix/5.0/agent/kaniko-build.py | 196 ------------------ .../zabbix/5.0/agent/requirements.txt | 1 + linux/advanced/zabbix/5.0/agent2/Makefile | 6 +- .../zabbix/5.0/agent2/kaniko-build.py | 196 ------------------ .../zabbix/5.0/agent2/requirements.txt | 1 + .../advanced/zabbix/5.0/java-gateway/Makefile | 6 +- .../zabbix/5.0/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/5.0/java-gateway/requirements.txt | 1 + .../advanced/zabbix/5.0/proxy-mysql/Makefile | 6 +- .../zabbix/5.0/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.0/proxy-mysql/requirements.txt | 1 + .../zabbix/5.0/proxy-sqlite3/Makefile | 6 +- .../zabbix/5.0/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/5.0/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/5.0/server-mysql/Makefile | 6 +- .../zabbix/5.0/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.0/server-mysql/requirements.txt | 1 + .../advanced/zabbix/5.0/server-pgsql/Makefile | 6 +- .../zabbix/5.0/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/5.0/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/5.0/snmptraps/Makefile | 6 +- .../zabbix/5.0/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/5.0/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/5.0/web-mysql/Makefile | 6 +- .../zabbix/5.0/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.0/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/5.0/web-pgsql/Makefile | 6 +- .../zabbix/5.0/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/5.0/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/5.2/agent/Makefile | 6 +- .../advanced/zabbix/5.2/agent/kaniko-build.py | 196 ------------------ .../zabbix/5.2/agent/requirements.txt | 1 + linux/advanced/zabbix/5.2/agent2/Makefile | 6 +- .../zabbix/5.2/agent2/kaniko-build.py | 196 ------------------ .../zabbix/5.2/agent2/requirements.txt | 1 + .../advanced/zabbix/5.2/java-gateway/Makefile | 6 +- .../zabbix/5.2/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/5.2/java-gateway/requirements.txt | 1 + .../advanced/zabbix/5.2/proxy-mysql/Makefile | 6 +- .../zabbix/5.2/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.2/proxy-mysql/requirements.txt | 1 + .../zabbix/5.2/proxy-sqlite3/Makefile | 6 +- .../zabbix/5.2/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/5.2/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/5.2/server-mysql/Makefile | 6 +- .../zabbix/5.2/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.2/server-mysql/requirements.txt | 1 + .../advanced/zabbix/5.2/server-pgsql/Makefile | 6 +- .../zabbix/5.2/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/5.2/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/5.2/snmptraps/Makefile | 6 +- .../zabbix/5.2/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/5.2/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/5.2/web-mysql/Makefile | 6 +- .../zabbix/5.2/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.2/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/5.2/web-pgsql/Makefile | 6 +- .../zabbix/5.2/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/5.2/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/5.4/agent/Makefile | 6 +- .../advanced/zabbix/5.4/agent/kaniko-build.py | 196 ------------------ .../zabbix/5.4/agent/requirements.txt | 1 + linux/advanced/zabbix/5.4/agent2/Makefile | 6 +- .../zabbix/5.4/agent2/kaniko-build.py | 196 ------------------ .../zabbix/5.4/agent2/requirements.txt | 1 + .../advanced/zabbix/5.4/java-gateway/Makefile | 6 +- .../zabbix/5.4/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/5.4/java-gateway/requirements.txt | 1 + .../advanced/zabbix/5.4/proxy-mysql/Makefile | 6 +- .../zabbix/5.4/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.4/proxy-mysql/requirements.txt | 1 + .../zabbix/5.4/proxy-sqlite3/Makefile | 6 +- .../zabbix/5.4/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/5.4/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/5.4/server-mysql/Makefile | 6 +- .../zabbix/5.4/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.4/server-mysql/requirements.txt | 1 + .../advanced/zabbix/5.4/server-pgsql/Makefile | 6 +- .../zabbix/5.4/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/5.4/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/5.4/snmptraps/Makefile | 6 +- .../zabbix/5.4/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/5.4/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/5.4/web-mysql/Makefile | 6 +- .../zabbix/5.4/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/5.4/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/5.4/web-pgsql/Makefile | 6 +- .../zabbix/5.4/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/5.4/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/6.0/agent/Makefile | 6 +- .../advanced/zabbix/6.0/agent/kaniko-build.py | 196 ------------------ .../zabbix/6.0/agent/requirements.txt | 1 + linux/advanced/zabbix/6.0/agent2/Makefile | 6 +- .../zabbix/6.0/agent2/kaniko-build.py | 196 ------------------ .../zabbix/6.0/agent2/requirements.txt | 1 + .../advanced/zabbix/6.0/java-gateway/Makefile | 6 +- .../zabbix/6.0/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/6.0/java-gateway/requirements.txt | 1 + .../advanced/zabbix/6.0/proxy-mysql/Makefile | 6 +- .../zabbix/6.0/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.0/proxy-mysql/requirements.txt | 1 + .../zabbix/6.0/proxy-sqlite3/Makefile | 6 +- .../zabbix/6.0/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/6.0/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/6.0/server-mysql/Makefile | 6 +- .../zabbix/6.0/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.0/server-mysql/requirements.txt | 1 + .../advanced/zabbix/6.0/server-pgsql/Makefile | 6 +- .../zabbix/6.0/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/6.0/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/6.0/snmptraps/Makefile | 6 +- .../zabbix/6.0/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/6.0/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/6.0/web-mysql/Makefile | 6 +- .../zabbix/6.0/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.0/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/6.0/web-pgsql/Makefile | 6 +- .../zabbix/6.0/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/6.0/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/6.2/agent/Makefile | 6 +- .../advanced/zabbix/6.2/agent/kaniko-build.py | 196 ------------------ .../zabbix/6.2/agent/requirements.txt | 1 + linux/advanced/zabbix/6.2/agent2/Makefile | 6 +- .../zabbix/6.2/agent2/kaniko-build.py | 196 ------------------ .../zabbix/6.2/agent2/requirements.txt | 1 + .../advanced/zabbix/6.2/java-gateway/Makefile | 6 +- .../zabbix/6.2/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/6.2/java-gateway/requirements.txt | 1 + .../advanced/zabbix/6.2/proxy-mysql/Makefile | 6 +- .../zabbix/6.2/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.2/proxy-mysql/requirements.txt | 1 + .../zabbix/6.2/proxy-sqlite3/Makefile | 6 +- .../zabbix/6.2/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/6.2/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/6.2/server-mysql/Makefile | 6 +- .../zabbix/6.2/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.2/server-mysql/requirements.txt | 1 + .../advanced/zabbix/6.2/server-pgsql/Makefile | 6 +- .../zabbix/6.2/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/6.2/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/6.2/snmptraps/Makefile | 6 +- .../zabbix/6.2/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/6.2/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/6.2/web-mysql/Makefile | 6 +- .../zabbix/6.2/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.2/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/6.2/web-pgsql/Makefile | 6 +- .../zabbix/6.2/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/6.2/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/6.4/agent/Makefile | 6 +- .../advanced/zabbix/6.4/agent/kaniko-build.py | 196 ------------------ .../zabbix/6.4/agent/requirements.txt | 1 + linux/advanced/zabbix/6.4/agent2/Makefile | 6 +- .../zabbix/6.4/agent2/kaniko-build.py | 196 ------------------ .../zabbix/6.4/agent2/requirements.txt | 1 + .../advanced/zabbix/6.4/java-gateway/Makefile | 6 +- .../zabbix/6.4/java-gateway/kaniko-build.py | 196 ------------------ .../zabbix/6.4/java-gateway/requirements.txt | 1 + .../advanced/zabbix/6.4/proxy-mysql/Makefile | 6 +- .../zabbix/6.4/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.4/proxy-mysql/requirements.txt | 1 + .../zabbix/6.4/proxy-sqlite3/Makefile | 6 +- .../zabbix/6.4/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../zabbix/6.4/proxy-sqlite3/requirements.txt | 1 + .../advanced/zabbix/6.4/server-mysql/Makefile | 6 +- .../zabbix/6.4/server-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.4/server-mysql/requirements.txt | 1 + .../advanced/zabbix/6.4/server-pgsql/Makefile | 6 +- .../zabbix/6.4/server-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/6.4/server-pgsql/requirements.txt | 1 + linux/advanced/zabbix/6.4/snmptraps/Makefile | 6 +- .../zabbix/6.4/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/6.4/snmptraps/requirements.txt | 1 + linux/advanced/zabbix/6.4/web-mysql/Makefile | 6 +- .../zabbix/6.4/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/6.4/web-mysql/requirements.txt | 1 + linux/advanced/zabbix/6.4/web-pgsql/Makefile | 6 +- .../zabbix/6.4/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/6.4/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/latest/agent/Makefile | 6 +- .../zabbix/latest/agent/kaniko-build.py | 196 ------------------ .../zabbix/latest/agent/requirements.txt | 1 + linux/advanced/zabbix/latest/agent2/Makefile | 6 +- .../zabbix/latest/agent2/kaniko-build.py | 196 ------------------ .../zabbix/latest/agent2/requirements.txt | 1 + .../zabbix/latest/java-gateway/Makefile | 6 +- .../latest/java-gateway/kaniko-build.py | 196 ------------------ .../latest/java-gateway/requirements.txt | 1 + .../zabbix/latest/proxy-mysql/Makefile | 6 +- .../zabbix/latest/proxy-mysql/kaniko-build.py | 196 ------------------ .../latest/proxy-mysql/requirements.txt | 1 + .../zabbix/latest/proxy-sqlite3/Makefile | 6 +- .../latest/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../latest/proxy-sqlite3/requirements.txt | 1 + .../zabbix/latest/server-mysql/Makefile | 6 +- .../latest/server-mysql/kaniko-build.py | 196 ------------------ .../latest/server-mysql/requirements.txt | 1 + .../zabbix/latest/server-pgsql/Makefile | 6 +- .../latest/server-pgsql/kaniko-build.py | 196 ------------------ .../latest/server-pgsql/requirements.txt | 1 + .../advanced/zabbix/latest/snmptraps/Makefile | 6 +- .../zabbix/latest/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/latest/snmptraps/requirements.txt | 1 + .../advanced/zabbix/latest/web-mysql/Makefile | 6 +- .../zabbix/latest/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/latest/web-mysql/requirements.txt | 1 + .../advanced/zabbix/latest/web-pgsql/Makefile | 6 +- .../zabbix/latest/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/latest/web-pgsql/requirements.txt | 1 + linux/advanced/zabbix/trunk/agent/Makefile | 6 +- .../zabbix/trunk/agent/kaniko-build.py | 196 ------------------ .../zabbix/trunk/agent/requirements.txt | 1 + linux/advanced/zabbix/trunk/agent2/Makefile | 6 +- .../zabbix/trunk/agent2/kaniko-build.py | 196 ------------------ .../zabbix/trunk/agent2/requirements.txt | 1 + .../zabbix/trunk/java-gateway/Makefile | 6 +- .../zabbix/trunk/java-gateway/kaniko-build.py | 196 ------------------ .../trunk/java-gateway/requirements.txt | 1 + .../zabbix/trunk/proxy-mysql/Makefile | 6 +- .../zabbix/trunk/proxy-mysql/kaniko-build.py | 196 ------------------ .../zabbix/trunk/proxy-mysql/requirements.txt | 1 + .../zabbix/trunk/proxy-sqlite3/Makefile | 6 +- .../trunk/proxy-sqlite3/kaniko-build.py | 196 ------------------ .../trunk/proxy-sqlite3/requirements.txt | 1 + .../zabbix/trunk/server-mysql/Makefile | 6 +- .../zabbix/trunk/server-mysql/kaniko-build.py | 196 ------------------ .../trunk/server-mysql/requirements.txt | 1 + .../zabbix/trunk/server-pgsql/Makefile | 6 +- .../zabbix/trunk/server-pgsql/kaniko-build.py | 196 ------------------ .../trunk/server-pgsql/requirements.txt | 1 + .../advanced/zabbix/trunk/snmptraps/Makefile | 6 +- .../zabbix/trunk/snmptraps/kaniko-build.py | 196 ------------------ .../zabbix/trunk/snmptraps/requirements.txt | 1 + .../advanced/zabbix/trunk/web-mysql/Makefile | 6 +- .../zabbix/trunk/web-mysql/kaniko-build.py | 196 ------------------ .../zabbix/trunk/web-mysql/requirements.txt | 1 + .../advanced/zabbix/trunk/web-pgsql/Makefile | 6 +- .../zabbix/trunk/web-pgsql/kaniko-build.py | 196 ------------------ .../zabbix/trunk/web-pgsql/requirements.txt | 1 + .../ecosystem/epicmorg/devel/jdk11/Makefile | 6 +- .../epicmorg/devel/jdk11/kaniko-build.py | 196 ------------------ .../epicmorg/devel/jdk11/requirements.txt | 1 + .../ecosystem/epicmorg/devel/jdk16/Makefile | 6 +- .../epicmorg/devel/jdk16/kaniko-build.py | 196 ------------------ .../epicmorg/devel/jdk16/requirements.txt | 1 + .../ecosystem/epicmorg/devel/jdk6/Makefile | 6 +- .../epicmorg/devel/jdk6/kaniko-build.py | 196 ------------------ .../epicmorg/devel/jdk6/requirements.txt | 1 + .../ecosystem/epicmorg/devel/jdk7/Makefile | 6 +- .../epicmorg/devel/jdk7/kaniko-build.py | 196 ------------------ .../epicmorg/devel/jdk7/requirements.txt | 1 + .../ecosystem/epicmorg/devel/jdk8/Makefile | 6 +- .../epicmorg/devel/jdk8/kaniko-build.py | 196 ------------------ .../epicmorg/devel/jdk8/requirements.txt | 1 + .../ecosystem/epicmorg/devel/main/Makefile | 6 +- .../epicmorg/devel/main/kaniko-build.py | 196 ------------------ .../epicmorg/devel/main/requirements.txt | 1 + .../ecosystem/epicmorg/edge/jdk11/Makefile | 6 +- .../epicmorg/edge/jdk11/kaniko-build.py | 196 ------------------ .../epicmorg/edge/jdk11/requirements.txt | 1 + .../ecosystem/epicmorg/edge/jdk16/Makefile | 6 +- .../epicmorg/edge/jdk16/kaniko-build.py | 196 ------------------ .../epicmorg/edge/jdk16/requirements.txt | 1 + .../ecosystem/epicmorg/edge/jdk6/Makefile | 6 +- .../epicmorg/edge/jdk6/kaniko-build.py | 196 ------------------ .../epicmorg/edge/jdk6/requirements.txt | 1 + .../ecosystem/epicmorg/edge/jdk7/Makefile | 6 +- .../epicmorg/edge/jdk7/kaniko-build.py | 196 ------------------ .../epicmorg/edge/jdk7/requirements.txt | 1 + .../ecosystem/epicmorg/edge/jdk8/Makefile | 6 +- .../epicmorg/edge/jdk8/kaniko-build.py | 196 ------------------ .../epicmorg/edge/jdk8/requirements.txt | 1 + .../ecosystem/epicmorg/edge/main/Makefile | 6 +- .../epicmorg/edge/main/kaniko-build.py | 196 ------------------ .../epicmorg/edge/main/requirements.txt | 1 + .../ecosystem/epicmorg/prod/jdk11/Makefile | 6 +- .../epicmorg/prod/jdk11/kaniko-build.py | 196 ------------------ .../epicmorg/prod/jdk11/requirements.txt | 1 + .../ecosystem/epicmorg/prod/jdk16/Makefile | 6 +- .../epicmorg/prod/jdk16/kaniko-build.py | 196 ------------------ .../epicmorg/prod/jdk16/requirements.txt | 1 + .../ecosystem/epicmorg/prod/jdk6/Makefile | 6 +- .../epicmorg/prod/jdk6/kaniko-build.py | 196 ------------------ .../epicmorg/prod/jdk6/requirements.txt | 1 + .../ecosystem/epicmorg/prod/jdk7/Makefile | 6 +- .../epicmorg/prod/jdk7/kaniko-build.py | 196 ------------------ .../epicmorg/prod/jdk7/requirements.txt | 1 + .../ecosystem/epicmorg/prod/jdk8/Makefile | 6 +- .../epicmorg/prod/jdk8/kaniko-build.py | 196 ------------------ .../epicmorg/prod/jdk8/requirements.txt | 1 + .../ecosystem/epicmorg/prod/main/Makefile | 6 +- .../epicmorg/prod/main/kaniko-build.py | 196 ------------------ .../epicmorg/prod/main/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.0/Makefile | 6 +- .../freegpt-webui/1.0/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.0/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.1/Makefile | 6 +- .../freegpt-webui/1.1/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.1/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.2/Makefile | 6 +- .../freegpt-webui/1.2/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.2/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.3.1/Makefile | 6 +- .../freegpt-webui/1.3.1/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.3.1/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.3.2/Makefile | 6 +- .../freegpt-webui/1.3.2/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.3.2/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.3/Makefile | 6 +- .../freegpt-webui/1.3/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.3/requirements.txt | 1 + .../ecosystem/freegpt-webui/1.4/Makefile | 6 +- .../freegpt-webui/1.4/kaniko-build.py | 196 ------------------ .../freegpt-webui/1.4/requirements.txt | 1 + .../ecosystem/freegpt-webui/latest/Makefile | 6 +- .../freegpt-webui/latest/kaniko-build.py | 196 ------------------ .../freegpt-webui/latest/requirements.txt | 1 + .../ecosystem/syspass/sysPass/kaniko-build.py | 196 ------------------ .../syspass/sysPass/requirements.txt | 1 + linux/ecosystem/apache2/php5.5/Makefile | 6 +- .../ecosystem/apache2/php5.5/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php5.5/requirements.txt | 1 + linux/ecosystem/apache2/php7.0/Makefile | 6 +- .../ecosystem/apache2/php7.0/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php7.0/requirements.txt | 1 + linux/ecosystem/apache2/php7.1/Makefile | 6 +- .../ecosystem/apache2/php7.1/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php7.1/requirements.txt | 1 + linux/ecosystem/apache2/php7.2/Makefile | 6 +- .../ecosystem/apache2/php7.2/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php7.2/requirements.txt | 1 + linux/ecosystem/apache2/php7.3/Makefile | 6 +- .../ecosystem/apache2/php7.3/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php7.3/requirements.txt | 1 + linux/ecosystem/apache2/php7.4/Makefile | 6 +- .../ecosystem/apache2/php7.4/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php7.4/requirements.txt | 1 + linux/ecosystem/apache2/php8.0/Makefile | 6 +- .../ecosystem/apache2/php8.0/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php8.0/requirements.txt | 1 + linux/ecosystem/apache2/php8.1/Makefile | 6 +- .../ecosystem/apache2/php8.1/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php8.1/requirements.txt | 1 + linux/ecosystem/apache2/php8.2/Makefile | 6 +- .../ecosystem/apache2/php8.2/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php8.2/requirements.txt | 1 + linux/ecosystem/apache2/php8.3/Makefile | 6 +- .../ecosystem/apache2/php8.3/kaniko-build.py | 196 ------------------ .../ecosystem/apache2/php8.3/requirements.txt | 1 + .../atlassian/bitbucket/1/1.0.3/Makefile | 6 +- .../bitbucket/1/1.0.3/kaniko-build.py | 196 ------------------ .../bitbucket/1/1.0.3/requirements.txt | 1 + .../atlassian/bitbucket/1/1.1.2/Makefile | 6 +- .../bitbucket/1/1.1.2/kaniko-build.py | 196 ------------------ .../bitbucket/1/1.1.2/requirements.txt | 1 + .../atlassian/bitbucket/1/1.2.1/Makefile | 6 +- .../bitbucket/1/1.2.1/kaniko-build.py | 196 ------------------ .../bitbucket/1/1.2.1/requirements.txt | 1 + .../atlassian/bitbucket/1/1.2.4/Makefile | 6 +- .../bitbucket/1/1.2.4/kaniko-build.py | 196 ------------------ .../bitbucket/1/1.2.4/requirements.txt | 1 + .../atlassian/bitbucket/1/1.3.1/Makefile | 6 +- .../bitbucket/1/1.3.1/kaniko-build.py | 196 ------------------ .../bitbucket/1/1.3.1/requirements.txt | 1 + .../atlassian/bitbucket/2/2.0.3/Makefile | 6 +- .../bitbucket/2/2.0.3/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.0.3/requirements.txt | 1 + .../atlassian/bitbucket/2/2.1.2/Makefile | 6 +- .../bitbucket/2/2.1.2/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.1.2/requirements.txt | 1 + .../atlassian/bitbucket/2/2.10.0/Makefile | 6 +- .../bitbucket/2/2.10.0/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.10.0/requirements.txt | 1 + .../atlassian/bitbucket/2/2.10.1/Makefile | 6 +- .../bitbucket/2/2.10.1/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.10.1/requirements.txt | 1 + .../atlassian/bitbucket/2/2.10.2/Makefile | 6 +- .../bitbucket/2/2.10.2/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.10.2/requirements.txt | 1 + .../atlassian/bitbucket/2/2.10.3/Makefile | 6 +- .../bitbucket/2/2.10.3/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.10.3/requirements.txt | 1 + .../atlassian/bitbucket/2/2.10.4/Makefile | 6 +- .../bitbucket/2/2.10.4/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.10.4/requirements.txt | 1 + .../atlassian/bitbucket/2/2.10.5/Makefile | 6 +- .../bitbucket/2/2.10.5/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.10.5/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.3/Makefile | 6 +- .../bitbucket/2/2.11.3/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.3/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.4/Makefile | 6 +- .../bitbucket/2/2.11.4/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.4/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.5/Makefile | 6 +- .../bitbucket/2/2.11.5/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.5/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.6/Makefile | 6 +- .../bitbucket/2/2.11.6/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.6/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.7/Makefile | 6 +- .../bitbucket/2/2.11.7/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.7/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.8/Makefile | 6 +- .../bitbucket/2/2.11.8/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.8/requirements.txt | 1 + .../atlassian/bitbucket/2/2.11.9/Makefile | 6 +- .../bitbucket/2/2.11.9/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.11.9/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.0/Makefile | 6 +- .../bitbucket/2/2.12.0/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.0/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.1/Makefile | 6 +- .../bitbucket/2/2.12.1/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.1/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.2/Makefile | 6 +- .../bitbucket/2/2.12.2/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.2/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.3/Makefile | 6 +- .../bitbucket/2/2.12.3/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.3/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.4/Makefile | 6 +- .../bitbucket/2/2.12.4/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.4/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.5/Makefile | 6 +- .../bitbucket/2/2.12.5/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.5/requirements.txt | 1 + .../atlassian/bitbucket/2/2.12.6/Makefile | 6 +- .../bitbucket/2/2.12.6/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.12.6/requirements.txt | 1 + .../atlassian/bitbucket/2/2.2.0/Makefile | 6 +- .../bitbucket/2/2.2.0/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.2.0/requirements.txt | 1 + .../atlassian/bitbucket/2/2.3.1/Makefile | 6 +- .../bitbucket/2/2.3.1/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.3.1/requirements.txt | 1 + .../atlassian/bitbucket/2/2.4.2/Makefile | 6 +- .../bitbucket/2/2.4.2/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.4.2/requirements.txt | 1 + .../atlassian/bitbucket/2/2.5.4/Makefile | 6 +- .../bitbucket/2/2.5.4/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.5.4/requirements.txt | 1 + .../atlassian/bitbucket/2/2.6.5/Makefile | 6 +- .../bitbucket/2/2.6.5/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.6.5/requirements.txt | 1 + .../atlassian/bitbucket/2/2.7.6/Makefile | 6 +- .../bitbucket/2/2.7.6/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.7.6/requirements.txt | 1 + .../atlassian/bitbucket/2/2.8.4/Makefile | 6 +- .../bitbucket/2/2.8.4/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.8.4/requirements.txt | 1 + .../atlassian/bitbucket/2/2.8.5/Makefile | 6 +- .../bitbucket/2/2.8.5/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.8.5/requirements.txt | 1 + .../atlassian/bitbucket/2/2.9.1/Makefile | 6 +- .../bitbucket/2/2.9.1/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.9.1/requirements.txt | 1 + .../atlassian/bitbucket/2/2.9.2/Makefile | 6 +- .../bitbucket/2/2.9.2/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.9.2/requirements.txt | 1 + .../atlassian/bitbucket/2/2.9.3/Makefile | 6 +- .../bitbucket/2/2.9.3/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.9.3/requirements.txt | 1 + .../atlassian/bitbucket/2/2.9.4/Makefile | 6 +- .../bitbucket/2/2.9.4/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.9.4/requirements.txt | 1 + .../atlassian/bitbucket/2/2.9.5/Makefile | 6 +- .../bitbucket/2/2.9.5/kaniko-build.py | 196 ------------------ .../bitbucket/2/2.9.5/requirements.txt | 1 + .../atlassian/bitbucket/3/3.0.1/Makefile | 6 +- .../bitbucket/3/3.0.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.0.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.0.4/Makefile | 6 +- .../bitbucket/3/3.0.4/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.0.4/requirements.txt | 1 + .../atlassian/bitbucket/3/3.0.5/Makefile | 6 +- .../bitbucket/3/3.0.5/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.0.5/requirements.txt | 1 + .../atlassian/bitbucket/3/3.0.6/Makefile | 6 +- .../bitbucket/3/3.0.6/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.0.6/requirements.txt | 1 + .../atlassian/bitbucket/3/3.0.7/Makefile | 6 +- .../bitbucket/3/3.0.7/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.0.7/requirements.txt | 1 + .../atlassian/bitbucket/3/3.0.8/Makefile | 6 +- .../bitbucket/3/3.0.8/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.0.8/requirements.txt | 1 + .../atlassian/bitbucket/3/3.1.0/Makefile | 6 +- .../bitbucket/3/3.1.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.1.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.1.1/Makefile | 6 +- .../bitbucket/3/3.1.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.1.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.1.3/Makefile | 6 +- .../bitbucket/3/3.1.3/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.1.3/requirements.txt | 1 + .../atlassian/bitbucket/3/3.1.4/Makefile | 6 +- .../bitbucket/3/3.1.4/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.1.4/requirements.txt | 1 + .../atlassian/bitbucket/3/3.1.5/Makefile | 6 +- .../bitbucket/3/3.1.5/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.1.5/requirements.txt | 1 + .../atlassian/bitbucket/3/3.1.7/Makefile | 6 +- .../bitbucket/3/3.1.7/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.1.7/requirements.txt | 1 + .../atlassian/bitbucket/3/3.10.0/Makefile | 6 +- .../bitbucket/3/3.10.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.10.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.10.2/Makefile | 6 +- .../bitbucket/3/3.10.2/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.10.2/requirements.txt | 1 + .../atlassian/bitbucket/3/3.10.3/Makefile | 6 +- .../bitbucket/3/3.10.3/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.10.3/requirements.txt | 1 + .../atlassian/bitbucket/3/3.10.4/Makefile | 6 +- .../bitbucket/3/3.10.4/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.10.4/requirements.txt | 1 + .../atlassian/bitbucket/3/3.11.0/Makefile | 6 +- .../bitbucket/3/3.11.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.11.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.11.1/Makefile | 6 +- .../bitbucket/3/3.11.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.11.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.11.2/Makefile | 6 +- .../bitbucket/3/3.11.2/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.11.2/requirements.txt | 1 + .../atlassian/bitbucket/3/3.11.3/Makefile | 6 +- .../bitbucket/3/3.11.3/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.11.3/requirements.txt | 1 + .../atlassian/bitbucket/3/3.11.4/Makefile | 6 +- .../bitbucket/3/3.11.4/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.11.4/requirements.txt | 1 + .../atlassian/bitbucket/3/3.11.6/Makefile | 6 +- .../bitbucket/3/3.11.6/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.11.6/requirements.txt | 1 + .../atlassian/bitbucket/3/3.2.0/Makefile | 6 +- .../bitbucket/3/3.2.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.2.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.2.2/Makefile | 6 +- .../bitbucket/3/3.2.2/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.2.2/requirements.txt | 1 + .../atlassian/bitbucket/3/3.2.4/Makefile | 6 +- .../bitbucket/3/3.2.4/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.2.4/requirements.txt | 1 + .../atlassian/bitbucket/3/3.2.5/Makefile | 6 +- .../bitbucket/3/3.2.5/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.2.5/requirements.txt | 1 + .../atlassian/bitbucket/3/3.2.7/Makefile | 6 +- .../bitbucket/3/3.2.7/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.2.7/requirements.txt | 1 + .../atlassian/bitbucket/3/3.3.0/Makefile | 6 +- .../bitbucket/3/3.3.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.3.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.3.1/Makefile | 6 +- .../bitbucket/3/3.3.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.3.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.3.2/Makefile | 6 +- .../bitbucket/3/3.3.2/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.3.2/requirements.txt | 1 + .../atlassian/bitbucket/3/3.3.3/Makefile | 6 +- .../bitbucket/3/3.3.3/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.3.3/requirements.txt | 1 + .../atlassian/bitbucket/3/3.3.5/Makefile | 6 +- .../bitbucket/3/3.3.5/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.3.5/requirements.txt | 1 + .../atlassian/bitbucket/3/3.4.0/Makefile | 6 +- .../bitbucket/3/3.4.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.4.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.4.1/Makefile | 6 +- .../bitbucket/3/3.4.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.4.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.4.3/Makefile | 6 +- .../bitbucket/3/3.4.3/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.4.3/requirements.txt | 1 + .../atlassian/bitbucket/3/3.4.5/Makefile | 6 +- .../bitbucket/3/3.4.5/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.4.5/requirements.txt | 1 + .../atlassian/bitbucket/3/3.5.0/Makefile | 6 +- .../bitbucket/3/3.5.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.5.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.5.1/Makefile | 6 +- .../bitbucket/3/3.5.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.5.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.6.0/Makefile | 6 +- .../bitbucket/3/3.6.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.6.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.6.1/Makefile | 6 +- .../bitbucket/3/3.6.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.6.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.7.0/Makefile | 6 +- .../bitbucket/3/3.7.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.7.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.7.1/Makefile | 6 +- .../bitbucket/3/3.7.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.7.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.7.2/Makefile | 6 +- .../bitbucket/3/3.7.2/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.7.2/requirements.txt | 1 + .../atlassian/bitbucket/3/3.7.3/Makefile | 6 +- .../bitbucket/3/3.7.3/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.7.3/requirements.txt | 1 + .../atlassian/bitbucket/3/3.7.4/Makefile | 6 +- .../bitbucket/3/3.7.4/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.7.4/requirements.txt | 1 + .../atlassian/bitbucket/3/3.8.0/Makefile | 6 +- .../bitbucket/3/3.8.0/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.8.0/requirements.txt | 1 + .../atlassian/bitbucket/3/3.8.1/Makefile | 6 +- .../bitbucket/3/3.8.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.8.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.9.1/Makefile | 6 +- .../bitbucket/3/3.9.1/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.9.1/requirements.txt | 1 + .../atlassian/bitbucket/3/3.9.2/Makefile | 6 +- .../bitbucket/3/3.9.2/kaniko-build.py | 196 ------------------ .../bitbucket/3/3.9.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.1/Makefile | 6 +- .../bitbucket/4/4.0.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.2/Makefile | 6 +- .../bitbucket/4/4.0.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.3/Makefile | 6 +- .../bitbucket/4/4.0.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.4/Makefile | 6 +- .../bitbucket/4/4.0.4/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.4/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.6/Makefile | 6 +- .../bitbucket/4/4.0.6/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.6/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.7/Makefile | 6 +- .../bitbucket/4/4.0.7/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.7/requirements.txt | 1 + .../atlassian/bitbucket/4/4.0.8/Makefile | 6 +- .../bitbucket/4/4.0.8/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.0.8/requirements.txt | 1 + .../atlassian/bitbucket/4/4.1.0/Makefile | 6 +- .../bitbucket/4/4.1.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.1.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.1.3/Makefile | 6 +- .../bitbucket/4/4.1.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.1.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.1.4/Makefile | 6 +- .../bitbucket/4/4.1.4/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.1.4/requirements.txt | 1 + .../atlassian/bitbucket/4/4.1.6/Makefile | 6 +- .../bitbucket/4/4.1.6/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.1.6/requirements.txt | 1 + .../atlassian/bitbucket/4/4.10.0/Makefile | 6 +- .../bitbucket/4/4.10.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.10.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.10.1/Makefile | 6 +- .../bitbucket/4/4.10.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.10.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.10.2/Makefile | 6 +- .../bitbucket/4/4.10.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.10.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.11.1/Makefile | 6 +- .../bitbucket/4/4.11.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.11.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.11.2/Makefile | 6 +- .../bitbucket/4/4.11.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.11.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.12.0/Makefile | 6 +- .../bitbucket/4/4.12.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.12.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.12.1/Makefile | 6 +- .../bitbucket/4/4.12.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.12.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.13.0/Makefile | 6 +- .../bitbucket/4/4.13.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.13.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.13.1/Makefile | 6 +- .../bitbucket/4/4.13.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.13.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.0/Makefile | 6 +- .../bitbucket/4/4.14.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.1/Makefile | 6 +- .../bitbucket/4/4.14.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.10/Makefile | 6 +- .../bitbucket/4/4.14.10/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.10/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.11/Makefile | 6 +- .../bitbucket/4/4.14.11/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.11/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.12/Makefile | 6 +- .../bitbucket/4/4.14.12/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.12/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.2/Makefile | 6 +- .../bitbucket/4/4.14.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.3/Makefile | 6 +- .../bitbucket/4/4.14.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.4/Makefile | 6 +- .../bitbucket/4/4.14.4/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.4/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.5/Makefile | 6 +- .../bitbucket/4/4.14.5/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.5/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.6/Makefile | 6 +- .../bitbucket/4/4.14.6/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.6/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.7/Makefile | 6 +- .../bitbucket/4/4.14.7/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.7/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.8/Makefile | 6 +- .../bitbucket/4/4.14.8/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.8/requirements.txt | 1 + .../atlassian/bitbucket/4/4.14.9/Makefile | 6 +- .../bitbucket/4/4.14.9/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.14.9/requirements.txt | 1 + .../atlassian/bitbucket/4/4.2.0/Makefile | 6 +- .../bitbucket/4/4.2.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.2.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.2.1/Makefile | 6 +- .../bitbucket/4/4.2.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.2.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.2.2/Makefile | 6 +- .../bitbucket/4/4.2.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.2.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.2.3/Makefile | 6 +- .../bitbucket/4/4.2.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.2.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.3.0/Makefile | 6 +- .../bitbucket/4/4.3.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.3.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.3.1/Makefile | 6 +- .../bitbucket/4/4.3.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.3.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.3.2/Makefile | 6 +- .../bitbucket/4/4.3.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.3.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.3.3/Makefile | 6 +- .../bitbucket/4/4.3.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.3.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.4.0/Makefile | 6 +- .../bitbucket/4/4.4.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.4.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.4.1/Makefile | 6 +- .../bitbucket/4/4.4.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.4.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.4.2/Makefile | 6 +- .../bitbucket/4/4.4.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.4.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.4.4/Makefile | 6 +- .../bitbucket/4/4.4.4/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.4.4/requirements.txt | 1 + .../atlassian/bitbucket/4/4.5.1/Makefile | 6 +- .../bitbucket/4/4.5.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.5.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.5.2/Makefile | 6 +- .../bitbucket/4/4.5.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.5.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.5.3/Makefile | 6 +- .../bitbucket/4/4.5.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.5.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.6.0/Makefile | 6 +- .../bitbucket/4/4.6.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.6.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.6.1/Makefile | 6 +- .../bitbucket/4/4.6.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.6.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.6.2/Makefile | 6 +- .../bitbucket/4/4.6.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.6.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.6.3/Makefile | 6 +- .../bitbucket/4/4.6.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.6.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.6.4/Makefile | 6 +- .../bitbucket/4/4.6.4/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.6.4/requirements.txt | 1 + .../atlassian/bitbucket/4/4.7.1/Makefile | 6 +- .../bitbucket/4/4.7.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.7.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.7.2/Makefile | 6 +- .../bitbucket/4/4.7.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.7.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.0/Makefile | 6 +- .../bitbucket/4/4.8.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.1/Makefile | 6 +- .../bitbucket/4/4.8.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.1/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.2/Makefile | 6 +- .../bitbucket/4/4.8.2/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.2/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.3/Makefile | 6 +- .../bitbucket/4/4.8.3/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.3/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.4/Makefile | 6 +- .../bitbucket/4/4.8.4/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.4/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.5/Makefile | 6 +- .../bitbucket/4/4.8.5/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.5/requirements.txt | 1 + .../atlassian/bitbucket/4/4.8.6/Makefile | 6 +- .../bitbucket/4/4.8.6/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.8.6/requirements.txt | 1 + .../atlassian/bitbucket/4/4.9.0/Makefile | 6 +- .../bitbucket/4/4.9.0/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.9.0/requirements.txt | 1 + .../atlassian/bitbucket/4/4.9.1/Makefile | 6 +- .../bitbucket/4/4.9.1/kaniko-build.py | 196 ------------------ .../bitbucket/4/4.9.1/requirements.txt | 1 + .../atlassian/bitbucket/7/7.21.4/Makefile | 6 +- .../bitbucket/7/7.21.4/kaniko-build.py | 196 ------------------ .../bitbucket/7/7.21.4/requirements.txt | 1 + .../atlassian/bitbucket/8/8.0.0/Makefile | 6 +- .../bitbucket/8/8.0.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.0.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.0.3/Makefile | 6 +- .../bitbucket/8/8.0.3/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.0.3/requirements.txt | 1 + .../atlassian/bitbucket/8/8.1.0/Makefile | 6 +- .../bitbucket/8/8.1.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.1.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.1.3/Makefile | 6 +- .../bitbucket/8/8.1.3/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.1.3/requirements.txt | 1 + .../atlassian/bitbucket/8/8.12.0/Makefile | 6 +- .../bitbucket/8/8.12.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.12.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.17.0/Makefile | 6 +- .../bitbucket/8/8.17.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.17.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.19.6/Makefile | 6 +- .../bitbucket/8/8.19.6/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.19.6/requirements.txt | 1 + .../atlassian/bitbucket/8/8.2.0/Makefile | 6 +- .../bitbucket/8/8.2.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.2.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.2.2/Makefile | 6 +- .../bitbucket/8/8.2.2/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.2.2/requirements.txt | 1 + .../atlassian/bitbucket/8/8.3.0/Makefile | 6 +- .../bitbucket/8/8.3.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.3.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.3.1/Makefile | 6 +- .../bitbucket/8/8.3.1/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.3.1/requirements.txt | 1 + .../atlassian/bitbucket/8/8.3.2/Makefile | 6 +- .../bitbucket/8/8.3.2/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.3.2/requirements.txt | 1 + .../atlassian/bitbucket/8/8.3.3/Makefile | 6 +- .../bitbucket/8/8.3.3/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.3.3/requirements.txt | 1 + .../atlassian/bitbucket/8/8.4.0/Makefile | 6 +- .../bitbucket/8/8.4.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.4.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.4.1/Makefile | 6 +- .../bitbucket/8/8.4.1/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.4.1/requirements.txt | 1 + .../atlassian/bitbucket/8/8.4.2/Makefile | 6 +- .../bitbucket/8/8.4.2/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.4.2/requirements.txt | 1 + .../atlassian/bitbucket/8/8.5.0/Makefile | 6 +- .../bitbucket/8/8.5.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.5.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.5.1/Makefile | 6 +- .../bitbucket/8/8.5.1/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.5.1/requirements.txt | 1 + .../atlassian/bitbucket/8/8.6.0/Makefile | 6 +- .../bitbucket/8/8.6.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.6.0/requirements.txt | 1 + .../atlassian/bitbucket/8/8.6.1/Makefile | 6 +- .../bitbucket/8/8.6.1/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.6.1/requirements.txt | 1 + .../atlassian/bitbucket/8/8.7.0/Makefile | 6 +- .../bitbucket/8/8.7.0/kaniko-build.py | 196 ------------------ .../bitbucket/8/8.7.0/requirements.txt | 1 + .../atlassian/bitbucket/9/9.0.0/Makefile | 6 +- .../bitbucket/9/9.0.0/kaniko-build.py | 196 ------------------ .../bitbucket/9/9.0.0/requirements.txt | 1 + .../atlassian/bitbucket/latest/Makefile | 6 +- .../bitbucket/latest/kaniko-build.py | 196 ------------------ .../bitbucket/latest/requirements.txt | 1 + .../confluence/6/6.0.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.1/requirements.txt | 1 + .../confluence/6/6.0.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.2/requirements.txt | 1 + .../confluence/6/6.0.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.3/requirements.txt | 1 + .../confluence/6/6.0.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.4/requirements.txt | 1 + .../confluence/6/6.0.5/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.5/requirements.txt | 1 + .../confluence/6/6.0.6/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.6/requirements.txt | 1 + .../confluence/6/6.0.7/kaniko-build.py | 196 ------------------ .../confluence/6/6.0.7/requirements.txt | 1 + .../confluence/6/6.1.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.1.0/requirements.txt | 1 + .../confluence/6/6.1.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.1.1/requirements.txt | 1 + .../confluence/6/6.1.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.1.2/requirements.txt | 1 + .../confluence/6/6.1.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.1.3/requirements.txt | 1 + .../confluence/6/6.1.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.1.4/requirements.txt | 1 + .../confluence/6/6.10.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.10.0/requirements.txt | 1 + .../confluence/6/6.10.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.10.1/requirements.txt | 1 + .../confluence/6/6.10.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.10.2/requirements.txt | 1 + .../confluence/6/6.10.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.10.3/requirements.txt | 1 + .../confluence/6/6.11.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.11.0/requirements.txt | 1 + .../confluence/6/6.11.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.11.1/requirements.txt | 1 + .../confluence/6/6.11.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.11.2/requirements.txt | 1 + .../confluence/6/6.12.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.12.0/requirements.txt | 1 + .../confluence/6/6.12.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.12.1/requirements.txt | 1 + .../confluence/6/6.12.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.12.2/requirements.txt | 1 + .../confluence/6/6.12.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.12.3/requirements.txt | 1 + .../confluence/6/6.12.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.12.4/requirements.txt | 1 + .../confluence/6/6.13.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.0/requirements.txt | 1 + .../confluence/6/6.13.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.1/requirements.txt | 1 + .../confluence/6/6.13.10/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.10/requirements.txt | 1 + .../confluence/6/6.13.11/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.11/requirements.txt | 1 + .../confluence/6/6.13.12/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.12/requirements.txt | 1 + .../confluence/6/6.13.13/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.13/requirements.txt | 1 + .../confluence/6/6.13.15/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.15/requirements.txt | 1 + .../confluence/6/6.13.17/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.17/requirements.txt | 1 + .../confluence/6/6.13.18/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.18/requirements.txt | 1 + .../confluence/6/6.13.19/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.19/requirements.txt | 1 + .../confluence/6/6.13.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.2/requirements.txt | 1 + .../confluence/6/6.13.20/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.20/requirements.txt | 1 + .../confluence/6/6.13.21/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.21/requirements.txt | 1 + .../confluence/6/6.13.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.3/requirements.txt | 1 + .../confluence/6/6.13.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.4/requirements.txt | 1 + .../confluence/6/6.13.5/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.5/requirements.txt | 1 + .../confluence/6/6.13.6/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.6/requirements.txt | 1 + .../confluence/6/6.13.7/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.7/requirements.txt | 1 + .../confluence/6/6.13.8/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.8/requirements.txt | 1 + .../confluence/6/6.13.9/kaniko-build.py | 196 ------------------ .../confluence/6/6.13.9/requirements.txt | 1 + .../confluence/6/6.14.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.14.0/requirements.txt | 1 + .../confluence/6/6.14.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.14.1/requirements.txt | 1 + .../confluence/6/6.14.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.14.2/requirements.txt | 1 + .../confluence/6/6.14.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.14.3/requirements.txt | 1 + .../confluence/6/6.15.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.1/requirements.txt | 1 + .../confluence/6/6.15.10/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.10/requirements.txt | 1 + .../confluence/6/6.15.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.2/requirements.txt | 1 + .../confluence/6/6.15.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.4/requirements.txt | 1 + .../confluence/6/6.15.6/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.6/requirements.txt | 1 + .../confluence/6/6.15.7/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.7/requirements.txt | 1 + .../confluence/6/6.15.8/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.8/requirements.txt | 1 + .../confluence/6/6.15.9/kaniko-build.py | 196 ------------------ .../confluence/6/6.15.9/requirements.txt | 1 + .../confluence/6/6.2.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.2.0/requirements.txt | 1 + .../confluence/6/6.2.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.2.1/requirements.txt | 1 + .../confluence/6/6.2.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.2.2/requirements.txt | 1 + .../confluence/6/6.2.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.2.3/requirements.txt | 1 + .../confluence/6/6.2.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.2.4/requirements.txt | 1 + .../confluence/6/6.3.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.3.1/requirements.txt | 1 + .../confluence/6/6.3.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.3.2/requirements.txt | 1 + .../confluence/6/6.3.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.3.3/requirements.txt | 1 + .../confluence/6/6.3.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.3.4/requirements.txt | 1 + .../confluence/6/6.4.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.4.0/requirements.txt | 1 + .../confluence/6/6.4.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.4.1/requirements.txt | 1 + .../confluence/6/6.4.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.4.2/requirements.txt | 1 + .../confluence/6/6.4.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.4.3/requirements.txt | 1 + .../confluence/6/6.5.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.5.0/requirements.txt | 1 + .../confluence/6/6.5.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.5.1/requirements.txt | 1 + .../confluence/6/6.5.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.5.2/requirements.txt | 1 + .../confluence/6/6.5.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.5.3/requirements.txt | 1 + .../confluence/6/6.6.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.0/requirements.txt | 1 + .../confluence/6/6.6.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.1/requirements.txt | 1 + .../confluence/6/6.6.10/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.10/requirements.txt | 1 + .../confluence/6/6.6.11/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.11/requirements.txt | 1 + .../confluence/6/6.6.12/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.12/requirements.txt | 1 + .../confluence/6/6.6.13/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.13/requirements.txt | 1 + .../confluence/6/6.6.14/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.14/requirements.txt | 1 + .../confluence/6/6.6.15/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.15/requirements.txt | 1 + .../confluence/6/6.6.16/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.16/requirements.txt | 1 + .../confluence/6/6.6.17/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.17/requirements.txt | 1 + .../confluence/6/6.6.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.2/requirements.txt | 1 + .../confluence/6/6.6.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.3/requirements.txt | 1 + .../confluence/6/6.6.4/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.4/requirements.txt | 1 + .../confluence/6/6.6.5/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.5/requirements.txt | 1 + .../confluence/6/6.6.6/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.6/requirements.txt | 1 + .../confluence/6/6.6.7/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.7/requirements.txt | 1 + .../confluence/6/6.6.8/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.8/requirements.txt | 1 + .../confluence/6/6.6.9/kaniko-build.py | 196 ------------------ .../confluence/6/6.6.9/requirements.txt | 1 + .../confluence/6/6.7.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.7.0/requirements.txt | 1 + .../confluence/6/6.7.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.7.1/requirements.txt | 1 + .../confluence/6/6.7.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.7.2/requirements.txt | 1 + .../confluence/6/6.7.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.7.3/requirements.txt | 1 + .../confluence/6/6.8.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.8.0/requirements.txt | 1 + .../confluence/6/6.8.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.8.1/requirements.txt | 1 + .../confluence/6/6.8.2/kaniko-build.py | 196 ------------------ .../confluence/6/6.8.2/requirements.txt | 1 + .../confluence/6/6.8.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.8.3/requirements.txt | 1 + .../confluence/6/6.8.5/kaniko-build.py | 196 ------------------ .../confluence/6/6.8.5/requirements.txt | 1 + .../confluence/6/6.9.0/kaniko-build.py | 196 ------------------ .../confluence/6/6.9.0/requirements.txt | 1 + .../confluence/6/6.9.1/kaniko-build.py | 196 ------------------ .../confluence/6/6.9.1/requirements.txt | 1 + .../confluence/6/6.9.3/kaniko-build.py | 196 ------------------ .../confluence/6/6.9.3/requirements.txt | 1 + .../atlassian/confluence/7/7.19.0/Makefile | 6 +- .../confluence/7/7.19.0/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.0/requirements.txt | 1 + .../atlassian/confluence/7/7.19.1/Makefile | 6 +- .../confluence/7/7.19.1/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.1/requirements.txt | 1 + .../atlassian/confluence/7/7.19.16/Makefile | 6 +- .../confluence/7/7.19.16/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.16/requirements.txt | 1 + .../atlassian/confluence/7/7.19.17/Makefile | 6 +- .../confluence/7/7.19.17/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.17/requirements.txt | 1 + .../atlassian/confluence/7/7.19.18/Makefile | 6 +- .../confluence/7/7.19.18/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.18/requirements.txt | 1 + .../atlassian/confluence/7/7.19.2/Makefile | 6 +- .../confluence/7/7.19.2/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.2/requirements.txt | 1 + .../atlassian/confluence/7/7.19.3/Makefile | 6 +- .../confluence/7/7.19.3/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.3/requirements.txt | 1 + .../atlassian/confluence/7/7.19.4/Makefile | 6 +- .../confluence/7/7.19.4/kaniko-build.py | 196 ------------------ .../confluence/7/7.19.4/requirements.txt | 1 + .../atlassian/confluence/7/7.20.0/Makefile | 6 +- .../confluence/7/7.20.0/kaniko-build.py | 196 ------------------ .../confluence/7/7.20.0/requirements.txt | 1 + .../atlassian/confluence/7/7.20.1/Makefile | 6 +- .../confluence/7/7.20.1/kaniko-build.py | 196 ------------------ .../confluence/7/7.20.1/requirements.txt | 1 + .../atlassian/confluence/7/7.20.2/Makefile | 6 +- .../confluence/7/7.20.2/kaniko-build.py | 196 ------------------ .../confluence/7/7.20.2/requirements.txt | 1 + .../atlassian/confluence/7/7.20.3/Makefile | 6 +- .../confluence/7/7.20.3/kaniko-build.py | 196 ------------------ .../confluence/7/7.20.3/requirements.txt | 1 + .../atlassian/confluence/8/8.0.0/Makefile | 6 +- .../confluence/8/8.0.0/kaniko-build.py | 196 ------------------ .../confluence/8/8.0.0/requirements.txt | 1 + .../atlassian/confluence/8/8.0.1/Makefile | 6 +- .../confluence/8/8.0.1/kaniko-build.py | 196 ------------------ .../confluence/8/8.0.1/requirements.txt | 1 + .../atlassian/confluence/8/8.0.2/Makefile | 6 +- .../confluence/8/8.0.2/kaniko-build.py | 196 ------------------ .../confluence/8/8.0.2/requirements.txt | 1 + .../atlassian/confluence/8/8.4.0/Makefile | 6 +- .../confluence/8/8.4.0/kaniko-build.py | 196 ------------------ .../confluence/8/8.4.0/requirements.txt | 1 + .../atlassian/confluence/8/8.5.3/Makefile | 6 +- .../confluence/8/8.5.3/kaniko-build.py | 196 ------------------ .../confluence/8/8.5.3/requirements.txt | 1 + .../atlassian/confluence/8/8.6.1/Makefile | 6 +- .../confluence/8/8.6.1/kaniko-build.py | 196 ------------------ .../confluence/8/8.6.1/requirements.txt | 1 + .../atlassian/confluence/8/8.7.2/Makefile | 6 +- .../confluence/8/8.7.2/kaniko-build.py | 196 ------------------ .../confluence/8/8.7.2/requirements.txt | 1 + .../atlassian/confluence/8/8.8.1/Makefile | 6 +- .../confluence/8/8.8.1/kaniko-build.py | 196 ------------------ .../confluence/8/8.8.1/requirements.txt | 1 + .../atlassian/confluence/8/8.9.5/Makefile | 6 +- .../confluence/8/8.9.5/kaniko-build.py | 196 ------------------ .../confluence/8/8.9.5/requirements.txt | 1 + .../atlassian/confluence/9/9.0.0/Makefile | 6 +- .../confluence/9/9.0.0/kaniko-build.py | 196 ------------------ .../confluence/9/9.0.0/requirements.txt | 1 + .../atlassian/confluence/9/9.0.1/Makefile | 6 +- .../confluence/9/9.0.1/kaniko-build.py | 196 ------------------ .../confluence/9/9.0.1/requirements.txt | 1 + .../atlassian/confluence/latest/Makefile | 6 +- .../confluence/latest/kaniko-build.py | 196 ------------------ .../confluence/latest/requirements.txt | 1 + .../atlassian/confluence/templates/5/Makefile | 6 +- .../confluence/templates/5/kaniko-build.py | 196 ------------------ .../confluence/templates/5/requirements.txt | 1 + .../atlassian/confluence/templates/6/Makefile | 6 +- .../confluence/templates/6/kaniko-build.py | 196 ------------------ .../confluence/templates/6/requirements.txt | 1 + .../atlassian/crowd/5/5.1.1/Makefile | 6 +- .../atlassian/crowd/5/5.1.1/kaniko-build.py | 196 ------------------ .../atlassian/crowd/5/5.1.1/requirements.txt | 1 + .../ecosystem/atlassian/crowd/latest/Makefile | 6 +- .../atlassian/crowd/latest/kaniko-build.py | 196 ------------------ .../atlassian/crowd/latest/requirements.txt | 1 + .../crucible/1/1.0.3/kaniko-build.py | 196 ------------------ .../crucible/1/1.0.3/requirements.txt | 1 + .../crucible/1/1.0.4/kaniko-build.py | 196 ------------------ .../crucible/1/1.0.4/requirements.txt | 1 + .../atlassian/crucible/1/1.0/kaniko-build.py | 196 ------------------ .../atlassian/crucible/1/1.0/requirements.txt | 1 + .../crucible/1/1.1.1/kaniko-build.py | 196 ------------------ .../crucible/1/1.1.1/requirements.txt | 1 + .../crucible/1/1.1.2/kaniko-build.py | 196 ------------------ .../crucible/1/1.1.2/requirements.txt | 1 + .../crucible/1/1.1.3/kaniko-build.py | 196 ------------------ .../crucible/1/1.1.3/requirements.txt | 1 + .../crucible/1/1.1.4/kaniko-build.py | 196 ------------------ .../crucible/1/1.1.4/requirements.txt | 1 + .../atlassian/crucible/1/1.1/kaniko-build.py | 196 ------------------ .../atlassian/crucible/1/1.1/requirements.txt | 1 + .../crucible/1/1.2.1/kaniko-build.py | 196 ------------------ .../crucible/1/1.2.1/requirements.txt | 1 + .../crucible/1/1.2.2/kaniko-build.py | 196 ------------------ .../crucible/1/1.2.2/requirements.txt | 1 + .../crucible/1/1.2.3/kaniko-build.py | 196 ------------------ .../crucible/1/1.2.3/requirements.txt | 1 + .../atlassian/crucible/1/1.2/kaniko-build.py | 196 ------------------ .../atlassian/crucible/1/1.2/requirements.txt | 1 + .../crucible/1/1.5.1/kaniko-build.py | 196 ------------------ .../crucible/1/1.5.1/requirements.txt | 1 + .../crucible/1/1.5.2/kaniko-build.py | 196 ------------------ .../crucible/1/1.5.2/requirements.txt | 1 + .../crucible/1/1.5.3/kaniko-build.py | 196 ------------------ .../crucible/1/1.5.3/requirements.txt | 1 + .../crucible/1/1.5.4/kaniko-build.py | 196 ------------------ .../crucible/1/1.5.4/requirements.txt | 1 + .../atlassian/crucible/1/1.5/kaniko-build.py | 196 ------------------ .../atlassian/crucible/1/1.5/requirements.txt | 1 + .../crucible/1/1.6.0/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.0/requirements.txt | 1 + .../crucible/1/1.6.0Beta1/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.0Beta1/requirements.txt | 1 + .../crucible/1/1.6.0Beta2/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.0Beta2/requirements.txt | 1 + .../crucible/1/1.6.1/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.1/requirements.txt | 1 + .../crucible/1/1.6.2.1/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.2.1/requirements.txt | 1 + .../crucible/1/1.6.2/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.2/requirements.txt | 1 + .../crucible/1/1.6.3/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.3/requirements.txt | 1 + .../crucible/1/1.6.4/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.4/requirements.txt | 1 + .../crucible/1/1.6.5.a/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.5.a/requirements.txt | 1 + .../crucible/1/1.6.5/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.5/requirements.txt | 1 + .../crucible/1/1.6.5a/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.5a/requirements.txt | 1 + .../crucible/1/1.6.6/kaniko-build.py | 196 ------------------ .../crucible/1/1.6.6/requirements.txt | 1 + .../atlassian/crucible/templates/1/Makefile | 6 +- .../crucible/templates/1/kaniko-build.py | 196 ------------------ .../crucible/templates/1/requirements.txt | 1 + .../2/2.0.0.B3/kaniko-build.py | 196 ------------------ .../2/2.0.0.B3/requirements.txt | 1 + .../2/2.0.0.RC1/kaniko-build.py | 196 ------------------ .../2/2.0.0.RC1/requirements.txt | 1 + .../2/2.0.0.RC2/kaniko-build.py | 196 ------------------ .../2/2.0.0.RC2/requirements.txt | 1 + .../2/2.0.0.RC3/kaniko-build.py | 196 ------------------ .../2/2.0.0.RC3/requirements.txt | 1 + .../fisheye-crucible/2/2.0.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.0/requirements.txt | 1 + .../fisheye-crucible/2/2.0.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.1/requirements.txt | 1 + .../fisheye-crucible/2/2.0.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.2/requirements.txt | 1 + .../fisheye-crucible/2/2.0.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.3/requirements.txt | 1 + .../fisheye-crucible/2/2.0.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.4/requirements.txt | 1 + .../fisheye-crucible/2/2.0.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.5/requirements.txt | 1 + .../fisheye-crucible/2/2.0.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.0.6/requirements.txt | 1 + .../2/2.1.0.M2cc/kaniko-build.py | 196 ------------------ .../2/2.1.0.M2cc/requirements.txt | 1 + .../2/2.1.0.RC1/kaniko-build.py | 196 ------------------ .../2/2.1.0.RC1/requirements.txt | 1 + .../fisheye-crucible/2/2.1.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.1.0/requirements.txt | 1 + .../fisheye-crucible/2/2.1.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.1.1/requirements.txt | 1 + .../fisheye-crucible/2/2.1.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.1.2/requirements.txt | 1 + .../fisheye-crucible/2/2.1.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.1.3/requirements.txt | 1 + .../fisheye-crucible/2/2.1.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.1.4/requirements.txt | 1 + .../fisheye-crucible/2/2.10.0/kaniko-build.py | 196 ------------------ .../2/2.10.0/requirements.txt | 1 + .../fisheye-crucible/2/2.10.1/kaniko-build.py | 196 ------------------ .../2/2.10.1/requirements.txt | 1 + .../fisheye-crucible/2/2.10.2/kaniko-build.py | 196 ------------------ .../2/2.10.2/requirements.txt | 1 + .../fisheye-crucible/2/2.10.3/kaniko-build.py | 196 ------------------ .../2/2.10.3/requirements.txt | 1 + .../fisheye-crucible/2/2.10.4/kaniko-build.py | 196 ------------------ .../2/2.10.4/requirements.txt | 1 + .../fisheye-crucible/2/2.10.5/kaniko-build.py | 196 ------------------ .../2/2.10.5/requirements.txt | 1 + .../fisheye-crucible/2/2.10.6/kaniko-build.py | 196 ------------------ .../2/2.10.6/requirements.txt | 1 + .../fisheye-crucible/2/2.10.7/kaniko-build.py | 196 ------------------ .../2/2.10.7/requirements.txt | 1 + .../fisheye-crucible/2/2.10.8/kaniko-build.py | 196 ------------------ .../2/2.10.8/requirements.txt | 1 + .../fisheye-crucible/2/2.2.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.2.0/requirements.txt | 1 + .../fisheye-crucible/2/2.2.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.2.1/requirements.txt | 1 + .../fisheye-crucible/2/2.2.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.2.3/requirements.txt | 1 + .../fisheye-crucible/2/2.3.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.0/requirements.txt | 1 + .../fisheye-crucible/2/2.3.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.1/requirements.txt | 1 + .../fisheye-crucible/2/2.3.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.2/requirements.txt | 1 + .../fisheye-crucible/2/2.3.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.3/requirements.txt | 1 + .../fisheye-crucible/2/2.3.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.4/requirements.txt | 1 + .../fisheye-crucible/2/2.3.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.5/requirements.txt | 1 + .../fisheye-crucible/2/2.3.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.6/requirements.txt | 1 + .../fisheye-crucible/2/2.3.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.7/requirements.txt | 1 + .../fisheye-crucible/2/2.3.8/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.3.8/requirements.txt | 1 + .../fisheye-crucible/2/2.4.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.0/requirements.txt | 1 + .../fisheye-crucible/2/2.4.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.1/requirements.txt | 1 + .../fisheye-crucible/2/2.4.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.2/requirements.txt | 1 + .../fisheye-crucible/2/2.4.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.3/requirements.txt | 1 + .../fisheye-crucible/2/2.4.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.4/requirements.txt | 1 + .../fisheye-crucible/2/2.4.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.5/requirements.txt | 1 + .../fisheye-crucible/2/2.4.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.4.6/requirements.txt | 1 + .../fisheye-crucible/2/2.5.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.0/requirements.txt | 1 + .../fisheye-crucible/2/2.5.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.1/requirements.txt | 1 + .../fisheye-crucible/2/2.5.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.2/requirements.txt | 1 + .../fisheye-crucible/2/2.5.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.3/requirements.txt | 1 + .../fisheye-crucible/2/2.5.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.4/requirements.txt | 1 + .../fisheye-crucible/2/2.5.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.5/requirements.txt | 1 + .../fisheye-crucible/2/2.5.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.6/requirements.txt | 1 + .../fisheye-crucible/2/2.5.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.7/requirements.txt | 1 + .../fisheye-crucible/2/2.5.8/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.8/requirements.txt | 1 + .../fisheye-crucible/2/2.5.9/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.5.9/requirements.txt | 1 + .../fisheye-crucible/2/2.6.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.0/requirements.txt | 1 + .../fisheye-crucible/2/2.6.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.1/requirements.txt | 1 + .../fisheye-crucible/2/2.6.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.2/requirements.txt | 1 + .../fisheye-crucible/2/2.6.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.3/requirements.txt | 1 + .../fisheye-crucible/2/2.6.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.4/requirements.txt | 1 + .../fisheye-crucible/2/2.6.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.5/requirements.txt | 1 + .../fisheye-crucible/2/2.6.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.6/requirements.txt | 1 + .../fisheye-crucible/2/2.6.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.7/requirements.txt | 1 + .../fisheye-crucible/2/2.6.8/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.8/requirements.txt | 1 + .../fisheye-crucible/2/2.6.9/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.6.9/requirements.txt | 1 + .../2/2.7.0-EAP-1/kaniko-build.py | 196 ------------------ .../2/2.7.0-EAP-1/requirements.txt | 1 + .../2/2.7.0-EAP-2/kaniko-build.py | 196 ------------------ .../2/2.7.0-EAP-2/requirements.txt | 1 + .../fisheye-crucible/2/2.7.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.0/requirements.txt | 1 + .../fisheye-crucible/2/2.7.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.1/requirements.txt | 1 + .../fisheye-crucible/2/2.7.10/kaniko-build.py | 196 ------------------ .../2/2.7.10/requirements.txt | 1 + .../fisheye-crucible/2/2.7.11/kaniko-build.py | 196 ------------------ .../2/2.7.11/requirements.txt | 1 + .../fisheye-crucible/2/2.7.12/kaniko-build.py | 196 ------------------ .../2/2.7.12/requirements.txt | 1 + .../fisheye-crucible/2/2.7.13/kaniko-build.py | 196 ------------------ .../2/2.7.13/requirements.txt | 1 + .../fisheye-crucible/2/2.7.14/kaniko-build.py | 196 ------------------ .../2/2.7.14/requirements.txt | 1 + .../fisheye-crucible/2/2.7.15/kaniko-build.py | 196 ------------------ .../2/2.7.15/requirements.txt | 1 + .../fisheye-crucible/2/2.7.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.2/requirements.txt | 1 + .../fisheye-crucible/2/2.7.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.3/requirements.txt | 1 + .../fisheye-crucible/2/2.7.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.4/requirements.txt | 1 + .../fisheye-crucible/2/2.7.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.5/requirements.txt | 1 + .../fisheye-crucible/2/2.7.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.6/requirements.txt | 1 + .../fisheye-crucible/2/2.7.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.7/requirements.txt | 1 + .../fisheye-crucible/2/2.7.8/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.8/requirements.txt | 1 + .../fisheye-crucible/2/2.7.9/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.7.9/requirements.txt | 1 + .../2/2.8.0-m1/kaniko-build.py | 196 ------------------ .../2/2.8.0-m1/requirements.txt | 1 + .../fisheye-crucible/2/2.8.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.8.0/requirements.txt | 1 + .../fisheye-crucible/2/2.8.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.8.1/requirements.txt | 1 + .../fisheye-crucible/2/2.8.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.8.2/requirements.txt | 1 + .../fisheye-crucible/2/2.9.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.9.0/requirements.txt | 1 + .../fisheye-crucible/2/2.9.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.9.1/requirements.txt | 1 + .../fisheye-crucible/2/2.9.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/2/2.9.2/requirements.txt | 1 + .../fisheye-crucible/3/3.0.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.0.0/requirements.txt | 1 + .../fisheye-crucible/3/3.0.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.0.1/requirements.txt | 1 + .../fisheye-crucible/3/3.0.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.0.2/requirements.txt | 1 + .../fisheye-crucible/3/3.0.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.0.3/requirements.txt | 1 + .../fisheye-crucible/3/3.0.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.0.4/requirements.txt | 1 + .../fisheye-crucible/3/3.1.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.0/requirements.txt | 1 + .../fisheye-crucible/3/3.1.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.1/requirements.txt | 1 + .../fisheye-crucible/3/3.1.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.2/requirements.txt | 1 + .../fisheye-crucible/3/3.1.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.3/requirements.txt | 1 + .../fisheye-crucible/3/3.1.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.4/requirements.txt | 1 + .../fisheye-crucible/3/3.1.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.5/requirements.txt | 1 + .../fisheye-crucible/3/3.1.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.6/requirements.txt | 1 + .../fisheye-crucible/3/3.1.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.1.7/requirements.txt | 1 + .../fisheye-crucible/3/3.10.1/kaniko-build.py | 196 ------------------ .../3/3.10.1/requirements.txt | 1 + .../fisheye-crucible/3/3.10.2/kaniko-build.py | 196 ------------------ .../3/3.10.2/requirements.txt | 1 + .../fisheye-crucible/3/3.10.3/kaniko-build.py | 196 ------------------ .../3/3.10.3/requirements.txt | 1 + .../fisheye-crucible/3/3.10.4/kaniko-build.py | 196 ------------------ .../3/3.10.4/requirements.txt | 1 + .../fisheye-crucible/3/3.2.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.2.0/requirements.txt | 1 + .../fisheye-crucible/3/3.2.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.2.1/requirements.txt | 1 + .../fisheye-crucible/3/3.2.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.2.2/requirements.txt | 1 + .../fisheye-crucible/3/3.2.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.2.3/requirements.txt | 1 + .../fisheye-crucible/3/3.2.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.2.4/requirements.txt | 1 + .../fisheye-crucible/3/3.2.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.2.5/requirements.txt | 1 + .../fisheye-crucible/3/3.3.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.3.0/requirements.txt | 1 + .../fisheye-crucible/3/3.3.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.3.1/requirements.txt | 1 + .../fisheye-crucible/3/3.3.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.3.2/requirements.txt | 1 + .../fisheye-crucible/3/3.3.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.3.3/requirements.txt | 1 + .../fisheye-crucible/3/3.3.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.3.4/requirements.txt | 1 + .../fisheye-crucible/3/3.4.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.4.0/requirements.txt | 1 + .../fisheye-crucible/3/3.4.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.4.3/requirements.txt | 1 + .../fisheye-crucible/3/3.4.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.4.4/requirements.txt | 1 + .../fisheye-crucible/3/3.4.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.4.5/requirements.txt | 1 + .../fisheye-crucible/3/3.4.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.4.6/requirements.txt | 1 + .../fisheye-crucible/3/3.4.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.4.7/requirements.txt | 1 + .../fisheye-crucible/3/3.5.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.5.0/requirements.txt | 1 + .../fisheye-crucible/3/3.5.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.5.1/requirements.txt | 1 + .../fisheye-crucible/3/3.5.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.5.2/requirements.txt | 1 + .../fisheye-crucible/3/3.5.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.5.3/requirements.txt | 1 + .../fisheye-crucible/3/3.5.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.5.4/requirements.txt | 1 + .../fisheye-crucible/3/3.5.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.5.5/requirements.txt | 1 + .../fisheye-crucible/3/3.6.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.6.0/requirements.txt | 1 + .../fisheye-crucible/3/3.6.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.6.1/requirements.txt | 1 + .../fisheye-crucible/3/3.6.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.6.2/requirements.txt | 1 + .../fisheye-crucible/3/3.6.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.6.3/requirements.txt | 1 + .../fisheye-crucible/3/3.6.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.6.4/requirements.txt | 1 + .../fisheye-crucible/3/3.7.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.7.0/requirements.txt | 1 + .../fisheye-crucible/3/3.7.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.7.1/requirements.txt | 1 + .../fisheye-crucible/3/3.8.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.8.0/requirements.txt | 1 + .../fisheye-crucible/3/3.8.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.8.1/requirements.txt | 1 + .../fisheye-crucible/3/3.9.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.9.0/requirements.txt | 1 + .../fisheye-crucible/3/3.9.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.9.1/requirements.txt | 1 + .../fisheye-crucible/3/3.9.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/3/3.9.2/requirements.txt | 1 + .../fisheye-crucible/4/4.0.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.0.2/requirements.txt | 1 + .../fisheye-crucible/4/4.0.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.0.3/requirements.txt | 1 + .../fisheye-crucible/4/4.0.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.0.4/requirements.txt | 1 + .../fisheye-crucible/4/4.1.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.1.0/requirements.txt | 1 + .../fisheye-crucible/4/4.1.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.1.1/requirements.txt | 1 + .../fisheye-crucible/4/4.1.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.1.2/requirements.txt | 1 + .../fisheye-crucible/4/4.1.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.1.3/requirements.txt | 1 + .../fisheye-crucible/4/4.2.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.2.0/requirements.txt | 1 + .../fisheye-crucible/4/4.2.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.2.1/requirements.txt | 1 + .../fisheye-crucible/4/4.2.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.2.2/requirements.txt | 1 + .../fisheye-crucible/4/4.2.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.2.3/requirements.txt | 1 + .../fisheye-crucible/4/4.3.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.3.0/requirements.txt | 1 + .../fisheye-crucible/4/4.3.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.3.1/requirements.txt | 1 + .../fisheye-crucible/4/4.3.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.3.2/requirements.txt | 1 + .../fisheye-crucible/4/4.3.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.3.3/requirements.txt | 1 + .../fisheye-crucible/4/4.4.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.0/requirements.txt | 1 + .../fisheye-crucible/4/4.4.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.1/requirements.txt | 1 + .../fisheye-crucible/4/4.4.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.2/requirements.txt | 1 + .../fisheye-crucible/4/4.4.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.3/requirements.txt | 1 + .../fisheye-crucible/4/4.4.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.5/requirements.txt | 1 + .../fisheye-crucible/4/4.4.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.6/requirements.txt | 1 + .../fisheye-crucible/4/4.4.7/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.4.7/requirements.txt | 1 + .../fisheye-crucible/4/4.5.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.5.0/requirements.txt | 1 + .../fisheye-crucible/4/4.5.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.5.1/requirements.txt | 1 + .../fisheye-crucible/4/4.5.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.5.2/requirements.txt | 1 + .../fisheye-crucible/4/4.5.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.5.3/requirements.txt | 1 + .../fisheye-crucible/4/4.5.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.5.4/requirements.txt | 1 + .../fisheye-crucible/4/4.6.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.6.0/requirements.txt | 1 + .../fisheye-crucible/4/4.6.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.6.1/requirements.txt | 1 + .../fisheye-crucible/4/4.7.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.7.0/requirements.txt | 1 + .../fisheye-crucible/4/4.7.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.7.1/requirements.txt | 1 + .../fisheye-crucible/4/4.7.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.7.2/requirements.txt | 1 + .../fisheye-crucible/4/4.7.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.7.3/requirements.txt | 1 + .../fisheye-crucible/4/4.8.0/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.0/requirements.txt | 1 + .../fisheye-crucible/4/4.8.1/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.1/requirements.txt | 1 + .../fisheye-crucible/4/4.8.2/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.2/requirements.txt | 1 + .../fisheye-crucible/4/4.8.3/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.3/requirements.txt | 1 + .../fisheye-crucible/4/4.8.4/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.4/requirements.txt | 1 + .../fisheye-crucible/4/4.8.5/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.5/requirements.txt | 1 + .../fisheye-crucible/4/4.8.6/kaniko-build.py | 196 ------------------ .../fisheye-crucible/4/4.8.6/requirements.txt | 1 + .../fisheye-crucible/latest/Makefile | 6 +- .../fisheye-crucible/latest/kaniko-build.py | 196 ------------------ .../fisheye-crucible/latest/requirements.txt | 1 + .../fisheye-crucible/templates/2/Makefile | 6 +- .../templates/2/kaniko-build.py | 196 ------------------ .../templates/2/requirements.txt | 1 + .../fisheye-crucible/templates/3/Makefile | 6 +- .../templates/3/kaniko-build.py | 196 ------------------ .../templates/3/requirements.txt | 1 + .../fisheye-crucible/templates/4/Makefile | 6 +- .../templates/4/kaniko-build.py | 196 ------------------ .../templates/4/requirements.txt | 1 + .../fisheye/1/1.0.1a/kaniko-build.py | 196 ------------------ .../fisheye/1/1.0.1a/requirements.txt | 1 + .../atlassian/fisheye/1/1.1.3/kaniko-build.py | 196 ------------------ .../fisheye/1/1.1.3/requirements.txt | 1 + .../atlassian/fisheye/1/1.2.5/kaniko-build.py | 196 ------------------ .../fisheye/1/1.2.5/requirements.txt | 1 + .../atlassian/fisheye/1/1.3.3/kaniko-build.py | 196 ------------------ .../fisheye/1/1.3.3/requirements.txt | 1 + .../atlassian/fisheye/1/1.3.4/kaniko-build.py | 196 ------------------ .../fisheye/1/1.3.4/requirements.txt | 1 + .../atlassian/fisheye/1/1.3.5/kaniko-build.py | 196 ------------------ .../fisheye/1/1.3.5/requirements.txt | 1 + .../atlassian/fisheye/1/1.3.6/kaniko-build.py | 196 ------------------ .../fisheye/1/1.3.6/requirements.txt | 1 + .../atlassian/fisheye/1/1.3.7/kaniko-build.py | 196 ------------------ .../fisheye/1/1.3.7/requirements.txt | 1 + .../atlassian/fisheye/1/1.3.8/kaniko-build.py | 196 ------------------ .../fisheye/1/1.3.8/requirements.txt | 1 + .../atlassian/fisheye/1/1.4.1/kaniko-build.py | 196 ------------------ .../fisheye/1/1.4.1/requirements.txt | 1 + .../atlassian/fisheye/1/1.4.2/kaniko-build.py | 196 ------------------ .../fisheye/1/1.4.2/requirements.txt | 1 + .../atlassian/fisheye/1/1.4.3/kaniko-build.py | 196 ------------------ .../fisheye/1/1.4.3/requirements.txt | 1 + .../atlassian/fisheye/1/1.4/kaniko-build.py | 196 ------------------ .../atlassian/fisheye/1/1.4/requirements.txt | 1 + .../atlassian/fisheye/1/1.5.1/kaniko-build.py | 196 ------------------ .../fisheye/1/1.5.1/requirements.txt | 1 + .../atlassian/fisheye/1/1.5.2/kaniko-build.py | 196 ------------------ .../fisheye/1/1.5.2/requirements.txt | 1 + .../atlassian/fisheye/1/1.5.3/kaniko-build.py | 196 ------------------ .../fisheye/1/1.5.3/requirements.txt | 1 + .../atlassian/fisheye/1/1.5.4/kaniko-build.py | 196 ------------------ .../fisheye/1/1.5.4/requirements.txt | 1 + .../atlassian/fisheye/1/1.5/kaniko-build.py | 196 ------------------ .../atlassian/fisheye/1/1.5/requirements.txt | 1 + .../atlassian/fisheye/1/1.6.0/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.0/requirements.txt | 1 + .../fisheye/1/1.6.0Beta1/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.0Beta1/requirements.txt | 1 + .../fisheye/1/1.6.0Beta2/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.0Beta2/requirements.txt | 1 + .../atlassian/fisheye/1/1.6.1/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.1/requirements.txt | 1 + .../atlassian/fisheye/1/1.6.3/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.3/requirements.txt | 1 + .../atlassian/fisheye/1/1.6.4/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.4/requirements.txt | 1 + .../fisheye/1/1.6.5.a/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.5.a/requirements.txt | 1 + .../atlassian/fisheye/1/1.6.5/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.5/requirements.txt | 1 + .../fisheye/1/1.6.5a/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.5a/requirements.txt | 1 + .../atlassian/fisheye/1/1.6.6/kaniko-build.py | 196 ------------------ .../fisheye/1/1.6.6/requirements.txt | 1 + .../atlassian/fisheye/templates/1/Makefile | 6 +- .../fisheye/templates/1/kaniko-build.py | 196 ------------------ .../fisheye/templates/1/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.1.1/Makefile | 6 +- .../atlassian/jira/4/4.1.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.1.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.1.2/Makefile | 6 +- .../atlassian/jira/4/4.1.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.1.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.2.1/Makefile | 6 +- .../atlassian/jira/4/4.2.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.2.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.2.2/Makefile | 6 +- .../atlassian/jira/4/4.2.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.2.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.2.3/Makefile | 6 +- .../atlassian/jira/4/4.2.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.2.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.2.4/Makefile | 6 +- .../atlassian/jira/4/4.2.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.2.4/requirements.txt | 1 + linux/ecosystem/atlassian/jira/4/4.2/Makefile | 6 +- .../atlassian/jira/4/4.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.3.1/Makefile | 6 +- .../atlassian/jira/4/4.3.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.3.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.3.2/Makefile | 6 +- .../atlassian/jira/4/4.3.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.3.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.3.3/Makefile | 6 +- .../atlassian/jira/4/4.3.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.3.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.3.4/Makefile | 6 +- .../atlassian/jira/4/4.3.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.3.4/requirements.txt | 1 + linux/ecosystem/atlassian/jira/4/4.3/Makefile | 6 +- .../atlassian/jira/4/4.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.4.1/Makefile | 6 +- .../atlassian/jira/4/4.4.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.4.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.4.3/Makefile | 6 +- .../atlassian/jira/4/4.4.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.4.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.4.4/Makefile | 6 +- .../atlassian/jira/4/4.4.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.4.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/4/4.4.5/Makefile | 6 +- .../atlassian/jira/4/4.4.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.4.5/requirements.txt | 1 + linux/ecosystem/atlassian/jira/4/4.4/Makefile | 6 +- .../atlassian/jira/4/4.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/4/4.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.1/Makefile | 6 +- .../atlassian/jira/5/5.0.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.2/Makefile | 6 +- .../atlassian/jira/5/5.0.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.3/Makefile | 6 +- .../atlassian/jira/5/5.0.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.4/Makefile | 6 +- .../atlassian/jira/5/5.0.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.5/Makefile | 6 +- .../atlassian/jira/5/5.0.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.6/Makefile | 6 +- .../atlassian/jira/5/5.0.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.0.7/Makefile | 6 +- .../atlassian/jira/5/5.0.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0.7/requirements.txt | 1 + linux/ecosystem/atlassian/jira/5/5.0/Makefile | 6 +- .../atlassian/jira/5/5.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.1/Makefile | 6 +- .../atlassian/jira/5/5.1.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.2/Makefile | 6 +- .../atlassian/jira/5/5.1.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.3/Makefile | 6 +- .../atlassian/jira/5/5.1.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.4/Makefile | 6 +- .../atlassian/jira/5/5.1.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.5/Makefile | 6 +- .../atlassian/jira/5/5.1.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.6/Makefile | 6 +- .../atlassian/jira/5/5.1.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.7/Makefile | 6 +- .../atlassian/jira/5/5.1.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.1.8/Makefile | 6 +- .../atlassian/jira/5/5.1.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1.8/requirements.txt | 1 + linux/ecosystem/atlassian/jira/5/5.1/Makefile | 6 +- .../atlassian/jira/5/5.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.1/Makefile | 6 +- .../atlassian/jira/5/5.2.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.1/requirements.txt | 1 + .../atlassian/jira/5/5.2.10/Makefile | 6 +- .../atlassian/jira/5/5.2.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.10/requirements.txt | 1 + .../atlassian/jira/5/5.2.11/Makefile | 6 +- .../atlassian/jira/5/5.2.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.11/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.2/Makefile | 6 +- .../atlassian/jira/5/5.2.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.3/Makefile | 6 +- .../atlassian/jira/5/5.2.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.3/requirements.txt | 1 + .../atlassian/jira/5/5.2.4.1/Makefile | 6 +- .../atlassian/jira/5/5.2.4.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.4.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.4/Makefile | 6 +- .../atlassian/jira/5/5.2.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.5/Makefile | 6 +- .../atlassian/jira/5/5.2.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.6/Makefile | 6 +- .../atlassian/jira/5/5.2.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.7/Makefile | 6 +- .../atlassian/jira/5/5.2.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.8/Makefile | 6 +- .../atlassian/jira/5/5.2.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/5/5.2.9/Makefile | 6 +- .../atlassian/jira/5/5.2.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2.9/requirements.txt | 1 + linux/ecosystem/atlassian/jira/5/5.2/Makefile | 6 +- .../atlassian/jira/5/5.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/5/5.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.1/Makefile | 6 +- .../atlassian/jira/6/6.0.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.2/Makefile | 6 +- .../atlassian/jira/6/6.0.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.3/Makefile | 6 +- .../atlassian/jira/6/6.0.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.4/Makefile | 6 +- .../atlassian/jira/6/6.0.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.5/Makefile | 6 +- .../atlassian/jira/6/6.0.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.6/Makefile | 6 +- .../atlassian/jira/6/6.0.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.7/Makefile | 6 +- .../atlassian/jira/6/6.0.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.0.8/Makefile | 6 +- .../atlassian/jira/6/6.0.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0.8/requirements.txt | 1 + linux/ecosystem/atlassian/jira/6/6.0/Makefile | 6 +- .../atlassian/jira/6/6.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.1/Makefile | 6 +- .../atlassian/jira/6/6.1.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.2/Makefile | 6 +- .../atlassian/jira/6/6.1.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.3/Makefile | 6 +- .../atlassian/jira/6/6.1.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.4/Makefile | 6 +- .../atlassian/jira/6/6.1.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.5/Makefile | 6 +- .../atlassian/jira/6/6.1.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.6/Makefile | 6 +- .../atlassian/jira/6/6.1.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.7/Makefile | 6 +- .../atlassian/jira/6/6.1.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.8/Makefile | 6 +- .../atlassian/jira/6/6.1.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.1.9/Makefile | 6 +- .../atlassian/jira/6/6.1.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1.9/requirements.txt | 1 + linux/ecosystem/atlassian/jira/6/6.1/Makefile | 6 +- .../atlassian/jira/6/6.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.1/Makefile | 6 +- .../atlassian/jira/6/6.2.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.2/Makefile | 6 +- .../atlassian/jira/6/6.2.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.3/Makefile | 6 +- .../atlassian/jira/6/6.2.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.4/Makefile | 6 +- .../atlassian/jira/6/6.2.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.5/Makefile | 6 +- .../atlassian/jira/6/6.2.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.6/Makefile | 6 +- .../atlassian/jira/6/6.2.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.2.7/Makefile | 6 +- .../atlassian/jira/6/6.2.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2.7/requirements.txt | 1 + linux/ecosystem/atlassian/jira/6/6.2/Makefile | 6 +- .../atlassian/jira/6/6.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.1/Makefile | 6 +- .../atlassian/jira/6/6.3.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.1/requirements.txt | 1 + .../atlassian/jira/6/6.3.10/Makefile | 6 +- .../atlassian/jira/6/6.3.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.10/requirements.txt | 1 + .../atlassian/jira/6/6.3.11/Makefile | 6 +- .../atlassian/jira/6/6.3.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.11/requirements.txt | 1 + .../atlassian/jira/6/6.3.12/Makefile | 6 +- .../atlassian/jira/6/6.3.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.12/requirements.txt | 1 + .../atlassian/jira/6/6.3.13/Makefile | 6 +- .../atlassian/jira/6/6.3.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.13/requirements.txt | 1 + .../atlassian/jira/6/6.3.14/Makefile | 6 +- .../atlassian/jira/6/6.3.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.14/requirements.txt | 1 + .../atlassian/jira/6/6.3.15/Makefile | 6 +- .../atlassian/jira/6/6.3.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.15/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.3/Makefile | 6 +- .../atlassian/jira/6/6.3.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.4/Makefile | 6 +- .../atlassian/jira/6/6.3.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.5/Makefile | 6 +- .../atlassian/jira/6/6.3.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.6/Makefile | 6 +- .../atlassian/jira/6/6.3.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.7/Makefile | 6 +- .../atlassian/jira/6/6.3.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.8/Makefile | 6 +- .../atlassian/jira/6/6.3.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.3.9/Makefile | 6 +- .../atlassian/jira/6/6.3.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3.9/requirements.txt | 1 + linux/ecosystem/atlassian/jira/6/6.3/Makefile | 6 +- .../atlassian/jira/6/6.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.1/Makefile | 6 +- .../atlassian/jira/6/6.4.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.1/requirements.txt | 1 + .../atlassian/jira/6/6.4.10/Makefile | 6 +- .../atlassian/jira/6/6.4.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.10/requirements.txt | 1 + .../atlassian/jira/6/6.4.11/Makefile | 6 +- .../atlassian/jira/6/6.4.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.11/requirements.txt | 1 + .../atlassian/jira/6/6.4.12/Makefile | 6 +- .../atlassian/jira/6/6.4.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.12/requirements.txt | 1 + .../atlassian/jira/6/6.4.13/Makefile | 6 +- .../atlassian/jira/6/6.4.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.13/requirements.txt | 1 + .../atlassian/jira/6/6.4.14/Makefile | 6 +- .../atlassian/jira/6/6.4.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.14/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.2/Makefile | 6 +- .../atlassian/jira/6/6.4.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.3/Makefile | 6 +- .../atlassian/jira/6/6.4.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.4/Makefile | 6 +- .../atlassian/jira/6/6.4.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.5/Makefile | 6 +- .../atlassian/jira/6/6.4.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.6/Makefile | 6 +- .../atlassian/jira/6/6.4.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.7/Makefile | 6 +- .../atlassian/jira/6/6.4.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.8/Makefile | 6 +- .../atlassian/jira/6/6.4.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/6/6.4.9/Makefile | 6 +- .../atlassian/jira/6/6.4.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4.9/requirements.txt | 1 + linux/ecosystem/atlassian/jira/6/6.4/Makefile | 6 +- .../atlassian/jira/6/6.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/6/6.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.0.0/Makefile | 6 +- .../atlassian/jira/7/7.0.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.0/requirements.txt | 1 + .../atlassian/jira/7/7.0.10/Makefile | 6 +- .../atlassian/jira/7/7.0.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.10/requirements.txt | 1 + .../atlassian/jira/7/7.0.11/Makefile | 6 +- .../atlassian/jira/7/7.0.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.11/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.0.2/Makefile | 6 +- .../atlassian/jira/7/7.0.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.0.4/Makefile | 6 +- .../atlassian/jira/7/7.0.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.0.5/Makefile | 6 +- .../atlassian/jira/7/7.0.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.0.9/Makefile | 6 +- .../atlassian/jira/7/7.0.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.0.9/requirements.txt | 1 + .../atlassian/jira/7/7.1.0-m01/Makefile | 6 +- .../jira/7/7.1.0-m01/kaniko-build.py | 196 ------------------ .../jira/7/7.1.0-m01/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.0/Makefile | 6 +- .../atlassian/jira/7/7.1.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.1/Makefile | 6 +- .../atlassian/jira/7/7.1.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.1/requirements.txt | 1 + .../atlassian/jira/7/7.1.10/Makefile | 6 +- .../atlassian/jira/7/7.1.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.10/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.2/Makefile | 6 +- .../atlassian/jira/7/7.1.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.4/Makefile | 6 +- .../atlassian/jira/7/7.1.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.6/Makefile | 6 +- .../atlassian/jira/7/7.1.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.7/Makefile | 6 +- .../atlassian/jira/7/7.1.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.8/Makefile | 6 +- .../atlassian/jira/7/7.1.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.1.9/Makefile | 6 +- .../atlassian/jira/7/7.1.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.1.9/requirements.txt | 1 + .../atlassian/jira/7/7.10.0/Makefile | 6 +- .../atlassian/jira/7/7.10.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.10.0/requirements.txt | 1 + .../atlassian/jira/7/7.10.1/Makefile | 6 +- .../atlassian/jira/7/7.10.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.10.1/requirements.txt | 1 + .../atlassian/jira/7/7.10.2/Makefile | 6 +- .../atlassian/jira/7/7.10.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.10.2/requirements.txt | 1 + .../atlassian/jira/7/7.11.0/Makefile | 6 +- .../atlassian/jira/7/7.11.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.11.0/requirements.txt | 1 + .../atlassian/jira/7/7.11.1/Makefile | 6 +- .../atlassian/jira/7/7.11.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.11.1/requirements.txt | 1 + .../atlassian/jira/7/7.11.2/Makefile | 6 +- .../atlassian/jira/7/7.11.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.11.2/requirements.txt | 1 + .../atlassian/jira/7/7.12.0/Makefile | 6 +- .../atlassian/jira/7/7.12.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.12.0/requirements.txt | 1 + .../atlassian/jira/7/7.12.1/Makefile | 6 +- .../atlassian/jira/7/7.12.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.12.1/requirements.txt | 1 + .../atlassian/jira/7/7.12.3/Makefile | 6 +- .../atlassian/jira/7/7.12.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.12.3/requirements.txt | 1 + .../atlassian/jira/7/7.13.0/Makefile | 6 +- .../atlassian/jira/7/7.13.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.0/requirements.txt | 1 + .../atlassian/jira/7/7.13.1/Makefile | 6 +- .../atlassian/jira/7/7.13.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.1/requirements.txt | 1 + .../atlassian/jira/7/7.13.11/Makefile | 6 +- .../atlassian/jira/7/7.13.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.11/requirements.txt | 1 + .../atlassian/jira/7/7.13.12/Makefile | 6 +- .../atlassian/jira/7/7.13.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.12/requirements.txt | 1 + .../atlassian/jira/7/7.13.13/Makefile | 6 +- .../atlassian/jira/7/7.13.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.13/requirements.txt | 1 + .../atlassian/jira/7/7.13.14/Makefile | 6 +- .../atlassian/jira/7/7.13.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.14/requirements.txt | 1 + .../atlassian/jira/7/7.13.15/Makefile | 6 +- .../atlassian/jira/7/7.13.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.15/requirements.txt | 1 + .../atlassian/jira/7/7.13.16/Makefile | 6 +- .../atlassian/jira/7/7.13.16/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.16/requirements.txt | 1 + .../atlassian/jira/7/7.13.17/Makefile | 6 +- .../atlassian/jira/7/7.13.17/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.17/requirements.txt | 1 + .../atlassian/jira/7/7.13.18/Makefile | 6 +- .../atlassian/jira/7/7.13.18/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.18/requirements.txt | 1 + .../atlassian/jira/7/7.13.2/Makefile | 6 +- .../atlassian/jira/7/7.13.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.2/requirements.txt | 1 + .../atlassian/jira/7/7.13.3/Makefile | 6 +- .../atlassian/jira/7/7.13.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.3/requirements.txt | 1 + .../atlassian/jira/7/7.13.4/Makefile | 6 +- .../atlassian/jira/7/7.13.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.4/requirements.txt | 1 + .../atlassian/jira/7/7.13.5/Makefile | 6 +- .../atlassian/jira/7/7.13.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.5/requirements.txt | 1 + .../atlassian/jira/7/7.13.6/Makefile | 6 +- .../atlassian/jira/7/7.13.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.6/requirements.txt | 1 + .../atlassian/jira/7/7.13.8/Makefile | 6 +- .../atlassian/jira/7/7.13.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.8/requirements.txt | 1 + .../atlassian/jira/7/7.13.9/Makefile | 6 +- .../atlassian/jira/7/7.13.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.13.9/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.0/Makefile | 6 +- .../atlassian/jira/7/7.2.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.1/Makefile | 6 +- .../atlassian/jira/7/7.2.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.1/requirements.txt | 1 + .../atlassian/jira/7/7.2.10/Makefile | 6 +- .../atlassian/jira/7/7.2.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.10/requirements.txt | 1 + .../atlassian/jira/7/7.2.11/Makefile | 6 +- .../atlassian/jira/7/7.2.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.11/requirements.txt | 1 + .../atlassian/jira/7/7.2.12/Makefile | 6 +- .../atlassian/jira/7/7.2.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.12/requirements.txt | 1 + .../atlassian/jira/7/7.2.13/Makefile | 6 +- .../atlassian/jira/7/7.2.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.13/requirements.txt | 1 + .../atlassian/jira/7/7.2.14/Makefile | 6 +- .../atlassian/jira/7/7.2.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.14/requirements.txt | 1 + .../atlassian/jira/7/7.2.15/Makefile | 6 +- .../atlassian/jira/7/7.2.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.15/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.2/Makefile | 6 +- .../atlassian/jira/7/7.2.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.3/Makefile | 6 +- .../atlassian/jira/7/7.2.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.4/Makefile | 6 +- .../atlassian/jira/7/7.2.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.6/Makefile | 6 +- .../atlassian/jira/7/7.2.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.7/Makefile | 6 +- .../atlassian/jira/7/7.2.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.8/Makefile | 6 +- .../atlassian/jira/7/7.2.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.2.9/Makefile | 6 +- .../atlassian/jira/7/7.2.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.2.9/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.0/Makefile | 6 +- .../atlassian/jira/7/7.3.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.1/Makefile | 6 +- .../atlassian/jira/7/7.3.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.2/Makefile | 6 +- .../atlassian/jira/7/7.3.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.3/Makefile | 6 +- .../atlassian/jira/7/7.3.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.4/Makefile | 6 +- .../atlassian/jira/7/7.3.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.5/Makefile | 6 +- .../atlassian/jira/7/7.3.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.6/Makefile | 6 +- .../atlassian/jira/7/7.3.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.7/Makefile | 6 +- .../atlassian/jira/7/7.3.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.8/Makefile | 6 +- .../atlassian/jira/7/7.3.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.3.9/Makefile | 6 +- .../atlassian/jira/7/7.3.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.3.9/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.0/Makefile | 6 +- .../atlassian/jira/7/7.4.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.1/Makefile | 6 +- .../atlassian/jira/7/7.4.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.2/Makefile | 6 +- .../atlassian/jira/7/7.4.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.3/Makefile | 6 +- .../atlassian/jira/7/7.4.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.4/Makefile | 6 +- .../atlassian/jira/7/7.4.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.5/Makefile | 6 +- .../atlassian/jira/7/7.4.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.4.6/Makefile | 6 +- .../atlassian/jira/7/7.4.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.4.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.5.0/Makefile | 6 +- .../atlassian/jira/7/7.5.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.5.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.5.1/Makefile | 6 +- .../atlassian/jira/7/7.5.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.5.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.5.2/Makefile | 6 +- .../atlassian/jira/7/7.5.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.5.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.5.3/Makefile | 6 +- .../atlassian/jira/7/7.5.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.5.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.5.4/Makefile | 6 +- .../atlassian/jira/7/7.5.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.5.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.0/Makefile | 6 +- .../atlassian/jira/7/7.6.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.1/Makefile | 6 +- .../atlassian/jira/7/7.6.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.1/requirements.txt | 1 + .../atlassian/jira/7/7.6.10/Makefile | 6 +- .../atlassian/jira/7/7.6.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.10/requirements.txt | 1 + .../atlassian/jira/7/7.6.11/Makefile | 6 +- .../atlassian/jira/7/7.6.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.11/requirements.txt | 1 + .../atlassian/jira/7/7.6.12/Makefile | 6 +- .../atlassian/jira/7/7.6.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.12/requirements.txt | 1 + .../atlassian/jira/7/7.6.13/Makefile | 6 +- .../atlassian/jira/7/7.6.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.13/requirements.txt | 1 + .../atlassian/jira/7/7.6.14/Makefile | 6 +- .../atlassian/jira/7/7.6.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.14/requirements.txt | 1 + .../atlassian/jira/7/7.6.15/Makefile | 6 +- .../atlassian/jira/7/7.6.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.15/requirements.txt | 1 + .../atlassian/jira/7/7.6.16/Makefile | 6 +- .../atlassian/jira/7/7.6.16/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.16/requirements.txt | 1 + .../atlassian/jira/7/7.6.17/Makefile | 6 +- .../atlassian/jira/7/7.6.17/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.17/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.2/Makefile | 6 +- .../atlassian/jira/7/7.6.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.3/Makefile | 6 +- .../atlassian/jira/7/7.6.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.4/Makefile | 6 +- .../atlassian/jira/7/7.6.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.6/Makefile | 6 +- .../atlassian/jira/7/7.6.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.7/Makefile | 6 +- .../atlassian/jira/7/7.6.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.8/Makefile | 6 +- .../atlassian/jira/7/7.6.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.6.9/Makefile | 6 +- .../atlassian/jira/7/7.6.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.6.9/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.7.0/Makefile | 6 +- .../atlassian/jira/7/7.7.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.7.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.7.1/Makefile | 6 +- .../atlassian/jira/7/7.7.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.7.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.7.2/Makefile | 6 +- .../atlassian/jira/7/7.7.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.7.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.7.4/Makefile | 6 +- .../atlassian/jira/7/7.7.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.7.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.8.0/Makefile | 6 +- .../atlassian/jira/7/7.8.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.8.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.8.1/Makefile | 6 +- .../atlassian/jira/7/7.8.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.8.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.8.2/Makefile | 6 +- .../atlassian/jira/7/7.8.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.8.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.8.4/Makefile | 6 +- .../atlassian/jira/7/7.8.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.8.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.9.0/Makefile | 6 +- .../atlassian/jira/7/7.9.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.9.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/7/7.9.2/Makefile | 6 +- .../atlassian/jira/7/7.9.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/7/7.9.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.0.0/Makefile | 6 +- .../atlassian/jira/8/8.0.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.0.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.0.2/Makefile | 6 +- .../atlassian/jira/8/8.0.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.0.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.0.3/Makefile | 6 +- .../atlassian/jira/8/8.0.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.0.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.1.0/Makefile | 6 +- .../atlassian/jira/8/8.1.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.1.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.1.1/Makefile | 6 +- .../atlassian/jira/8/8.1.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.1.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.1.2/Makefile | 6 +- .../atlassian/jira/8/8.1.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.1.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.1.3/Makefile | 6 +- .../atlassian/jira/8/8.1.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.1.3/requirements.txt | 1 + .../atlassian/jira/8/8.10.0/Makefile | 6 +- .../atlassian/jira/8/8.10.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.10.0/requirements.txt | 1 + .../atlassian/jira/8/8.10.1/Makefile | 6 +- .../atlassian/jira/8/8.10.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.10.1/requirements.txt | 1 + .../atlassian/jira/8/8.11.0/Makefile | 6 +- .../atlassian/jira/8/8.11.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.11.0/requirements.txt | 1 + .../atlassian/jira/8/8.11.1/Makefile | 6 +- .../atlassian/jira/8/8.11.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.11.1/requirements.txt | 1 + .../atlassian/jira/8/8.12.0/Makefile | 6 +- .../atlassian/jira/8/8.12.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.12.0/requirements.txt | 1 + .../atlassian/jira/8/8.12.1/Makefile | 6 +- .../atlassian/jira/8/8.12.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.12.1/requirements.txt | 1 + .../atlassian/jira/8/8.12.2/Makefile | 6 +- .../atlassian/jira/8/8.12.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.12.2/requirements.txt | 1 + .../atlassian/jira/8/8.12.3/Makefile | 6 +- .../atlassian/jira/8/8.12.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.12.3/requirements.txt | 1 + .../atlassian/jira/8/8.13.0/Makefile | 6 +- .../atlassian/jira/8/8.13.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.0/requirements.txt | 1 + .../atlassian/jira/8/8.13.1/Makefile | 6 +- .../atlassian/jira/8/8.13.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.1/requirements.txt | 1 + .../atlassian/jira/8/8.13.10/Makefile | 6 +- .../atlassian/jira/8/8.13.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.10/requirements.txt | 1 + .../atlassian/jira/8/8.13.11/Makefile | 6 +- .../atlassian/jira/8/8.13.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.11/requirements.txt | 1 + .../atlassian/jira/8/8.13.12/Makefile | 6 +- .../atlassian/jira/8/8.13.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.12/requirements.txt | 1 + .../atlassian/jira/8/8.13.13/Makefile | 6 +- .../atlassian/jira/8/8.13.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.13/requirements.txt | 1 + .../atlassian/jira/8/8.13.14/Makefile | 6 +- .../atlassian/jira/8/8.13.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.14/requirements.txt | 1 + .../atlassian/jira/8/8.13.15/Makefile | 6 +- .../atlassian/jira/8/8.13.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.15/requirements.txt | 1 + .../atlassian/jira/8/8.13.16/Makefile | 6 +- .../atlassian/jira/8/8.13.16/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.16/requirements.txt | 1 + .../atlassian/jira/8/8.13.17/Makefile | 6 +- .../atlassian/jira/8/8.13.17/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.17/requirements.txt | 1 + .../atlassian/jira/8/8.13.18/Makefile | 6 +- .../atlassian/jira/8/8.13.18/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.18/requirements.txt | 1 + .../atlassian/jira/8/8.13.19/Makefile | 6 +- .../atlassian/jira/8/8.13.19/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.19/requirements.txt | 1 + .../atlassian/jira/8/8.13.2/Makefile | 6 +- .../atlassian/jira/8/8.13.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.2/requirements.txt | 1 + .../atlassian/jira/8/8.13.20/Makefile | 6 +- .../atlassian/jira/8/8.13.20/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.20/requirements.txt | 1 + .../atlassian/jira/8/8.13.21/Makefile | 6 +- .../atlassian/jira/8/8.13.21/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.21/requirements.txt | 1 + .../atlassian/jira/8/8.13.22/Makefile | 6 +- .../atlassian/jira/8/8.13.22/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.22/requirements.txt | 1 + .../atlassian/jira/8/8.13.24/Makefile | 6 +- .../atlassian/jira/8/8.13.24/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.24/requirements.txt | 1 + .../atlassian/jira/8/8.13.25/Makefile | 6 +- .../atlassian/jira/8/8.13.25/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.25/requirements.txt | 1 + .../atlassian/jira/8/8.13.26/Makefile | 6 +- .../atlassian/jira/8/8.13.26/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.26/requirements.txt | 1 + .../atlassian/jira/8/8.13.27/Makefile | 6 +- .../atlassian/jira/8/8.13.27/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.27/requirements.txt | 1 + .../atlassian/jira/8/8.13.3/Makefile | 6 +- .../atlassian/jira/8/8.13.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.3/requirements.txt | 1 + .../atlassian/jira/8/8.13.4/Makefile | 6 +- .../atlassian/jira/8/8.13.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.4/requirements.txt | 1 + .../atlassian/jira/8/8.13.5/Makefile | 6 +- .../atlassian/jira/8/8.13.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.5/requirements.txt | 1 + .../atlassian/jira/8/8.13.6/Makefile | 6 +- .../atlassian/jira/8/8.13.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.6/requirements.txt | 1 + .../atlassian/jira/8/8.13.7/Makefile | 6 +- .../atlassian/jira/8/8.13.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.7/requirements.txt | 1 + .../atlassian/jira/8/8.13.8/Makefile | 6 +- .../atlassian/jira/8/8.13.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.8/requirements.txt | 1 + .../atlassian/jira/8/8.13.9/Makefile | 6 +- .../atlassian/jira/8/8.13.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.13.9/requirements.txt | 1 + .../atlassian/jira/8/8.14.0/Makefile | 6 +- .../atlassian/jira/8/8.14.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.14.0/requirements.txt | 1 + .../atlassian/jira/8/8.14.1/Makefile | 6 +- .../atlassian/jira/8/8.14.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.14.1/requirements.txt | 1 + .../atlassian/jira/8/8.15.0/Makefile | 6 +- .../atlassian/jira/8/8.15.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.15.0/requirements.txt | 1 + .../atlassian/jira/8/8.15.1/Makefile | 6 +- .../atlassian/jira/8/8.15.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.15.1/requirements.txt | 1 + .../atlassian/jira/8/8.16.0/Makefile | 6 +- .../atlassian/jira/8/8.16.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.16.0/requirements.txt | 1 + .../atlassian/jira/8/8.16.1/Makefile | 6 +- .../atlassian/jira/8/8.16.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.16.1/requirements.txt | 1 + .../atlassian/jira/8/8.16.2/Makefile | 6 +- .../atlassian/jira/8/8.16.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.16.2/requirements.txt | 1 + .../atlassian/jira/8/8.17.0/Makefile | 6 +- .../atlassian/jira/8/8.17.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.17.0/requirements.txt | 1 + .../atlassian/jira/8/8.17.1/Makefile | 6 +- .../atlassian/jira/8/8.17.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.17.1/requirements.txt | 1 + .../atlassian/jira/8/8.18.1/Makefile | 6 +- .../atlassian/jira/8/8.18.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.18.1/requirements.txt | 1 + .../atlassian/jira/8/8.18.2/Makefile | 6 +- .../atlassian/jira/8/8.18.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.18.2/requirements.txt | 1 + .../atlassian/jira/8/8.19.0/Makefile | 6 +- .../atlassian/jira/8/8.19.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.19.0/requirements.txt | 1 + .../atlassian/jira/8/8.19.1/Makefile | 6 +- .../atlassian/jira/8/8.19.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.19.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.0/Makefile | 6 +- .../atlassian/jira/8/8.2.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.1/Makefile | 6 +- .../atlassian/jira/8/8.2.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.2/Makefile | 6 +- .../atlassian/jira/8/8.2.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.3/Makefile | 6 +- .../atlassian/jira/8/8.2.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.4/Makefile | 6 +- .../atlassian/jira/8/8.2.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.5/Makefile | 6 +- .../atlassian/jira/8/8.2.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.2.6/Makefile | 6 +- .../atlassian/jira/8/8.2.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.2.6/requirements.txt | 1 + .../atlassian/jira/8/8.20.0/Makefile | 6 +- .../atlassian/jira/8/8.20.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.0/requirements.txt | 1 + .../atlassian/jira/8/8.20.1/Makefile | 6 +- .../atlassian/jira/8/8.20.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.1/requirements.txt | 1 + .../atlassian/jira/8/8.20.10/Makefile | 6 +- .../atlassian/jira/8/8.20.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.10/requirements.txt | 1 + .../atlassian/jira/8/8.20.11/Makefile | 6 +- .../atlassian/jira/8/8.20.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.11/requirements.txt | 1 + .../atlassian/jira/8/8.20.12/Makefile | 6 +- .../atlassian/jira/8/8.20.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.12/requirements.txt | 1 + .../atlassian/jira/8/8.20.13/Makefile | 6 +- .../atlassian/jira/8/8.20.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.13/requirements.txt | 1 + .../atlassian/jira/8/8.20.14/Makefile | 6 +- .../atlassian/jira/8/8.20.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.14/requirements.txt | 1 + .../atlassian/jira/8/8.20.15/Makefile | 6 +- .../atlassian/jira/8/8.20.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.15/requirements.txt | 1 + .../atlassian/jira/8/8.20.16/Makefile | 6 +- .../atlassian/jira/8/8.20.16/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.16/requirements.txt | 1 + .../atlassian/jira/8/8.20.17/Makefile | 6 +- .../atlassian/jira/8/8.20.17/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.17/requirements.txt | 1 + .../atlassian/jira/8/8.20.19/Makefile | 6 +- .../atlassian/jira/8/8.20.19/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.19/requirements.txt | 1 + .../atlassian/jira/8/8.20.2/Makefile | 6 +- .../atlassian/jira/8/8.20.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.2/requirements.txt | 1 + .../atlassian/jira/8/8.20.20/Makefile | 6 +- .../atlassian/jira/8/8.20.20/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.20/requirements.txt | 1 + .../atlassian/jira/8/8.20.21/Makefile | 6 +- .../atlassian/jira/8/8.20.21/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.21/requirements.txt | 1 + .../atlassian/jira/8/8.20.22/Makefile | 6 +- .../atlassian/jira/8/8.20.22/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.22/requirements.txt | 1 + .../atlassian/jira/8/8.20.23/Makefile | 6 +- .../atlassian/jira/8/8.20.23/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.23/requirements.txt | 1 + .../atlassian/jira/8/8.20.24/Makefile | 6 +- .../atlassian/jira/8/8.20.24/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.24/requirements.txt | 1 + .../atlassian/jira/8/8.20.25/Makefile | 6 +- .../atlassian/jira/8/8.20.25/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.25/requirements.txt | 1 + .../atlassian/jira/8/8.20.26/Makefile | 6 +- .../atlassian/jira/8/8.20.26/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.26/requirements.txt | 1 + .../atlassian/jira/8/8.20.27/Makefile | 6 +- .../atlassian/jira/8/8.20.27/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.27/requirements.txt | 1 + .../atlassian/jira/8/8.20.28/Makefile | 6 +- .../atlassian/jira/8/8.20.28/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.28/requirements.txt | 1 + .../atlassian/jira/8/8.20.29/Makefile | 6 +- .../atlassian/jira/8/8.20.29/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.29/requirements.txt | 1 + .../atlassian/jira/8/8.20.3/Makefile | 6 +- .../atlassian/jira/8/8.20.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.3/requirements.txt | 1 + .../atlassian/jira/8/8.20.30/Makefile | 6 +- .../atlassian/jira/8/8.20.30/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.30/requirements.txt | 1 + .../atlassian/jira/8/8.20.4/Makefile | 6 +- .../atlassian/jira/8/8.20.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.4/requirements.txt | 1 + .../atlassian/jira/8/8.20.5/Makefile | 6 +- .../atlassian/jira/8/8.20.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.5/requirements.txt | 1 + .../atlassian/jira/8/8.20.6/Makefile | 6 +- .../atlassian/jira/8/8.20.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.6/requirements.txt | 1 + .../atlassian/jira/8/8.20.7/Makefile | 6 +- .../atlassian/jira/8/8.20.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.7/requirements.txt | 1 + .../atlassian/jira/8/8.20.8/Makefile | 6 +- .../atlassian/jira/8/8.20.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.8/requirements.txt | 1 + .../atlassian/jira/8/8.20.9/Makefile | 6 +- .../atlassian/jira/8/8.20.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.20.9/requirements.txt | 1 + .../atlassian/jira/8/8.21.0/Makefile | 6 +- .../atlassian/jira/8/8.21.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.21.0/requirements.txt | 1 + .../atlassian/jira/8/8.21.1/Makefile | 6 +- .../atlassian/jira/8/8.21.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.21.1/requirements.txt | 1 + .../atlassian/jira/8/8.22.0/Makefile | 6 +- .../atlassian/jira/8/8.22.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.0/requirements.txt | 1 + .../atlassian/jira/8/8.22.1/Makefile | 6 +- .../atlassian/jira/8/8.22.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.1/requirements.txt | 1 + .../atlassian/jira/8/8.22.2/Makefile | 6 +- .../atlassian/jira/8/8.22.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.2/requirements.txt | 1 + .../atlassian/jira/8/8.22.3/Makefile | 6 +- .../atlassian/jira/8/8.22.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.3/requirements.txt | 1 + .../atlassian/jira/8/8.22.4/Makefile | 6 +- .../atlassian/jira/8/8.22.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.4/requirements.txt | 1 + .../atlassian/jira/8/8.22.5/Makefile | 6 +- .../atlassian/jira/8/8.22.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.5/requirements.txt | 1 + .../atlassian/jira/8/8.22.6/Makefile | 6 +- .../atlassian/jira/8/8.22.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.22.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.3.0/Makefile | 6 +- .../atlassian/jira/8/8.3.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.3.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.3.1/Makefile | 6 +- .../atlassian/jira/8/8.3.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.3.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.3.2/Makefile | 6 +- .../atlassian/jira/8/8.3.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.3.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.3.3/Makefile | 6 +- .../atlassian/jira/8/8.3.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.3.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.3.4/Makefile | 6 +- .../atlassian/jira/8/8.3.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.3.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.3.5/Makefile | 6 +- .../atlassian/jira/8/8.3.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.3.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.4.0/Makefile | 6 +- .../atlassian/jira/8/8.4.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.4.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.4.1/Makefile | 6 +- .../atlassian/jira/8/8.4.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.4.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.4.2/Makefile | 6 +- .../atlassian/jira/8/8.4.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.4.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.4.3/Makefile | 6 +- .../atlassian/jira/8/8.4.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.4.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.0/Makefile | 6 +- .../atlassian/jira/8/8.5.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.1/Makefile | 6 +- .../atlassian/jira/8/8.5.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.1/requirements.txt | 1 + .../atlassian/jira/8/8.5.10/Makefile | 6 +- .../atlassian/jira/8/8.5.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.10/requirements.txt | 1 + .../atlassian/jira/8/8.5.11/Makefile | 6 +- .../atlassian/jira/8/8.5.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.11/requirements.txt | 1 + .../atlassian/jira/8/8.5.12/Makefile | 6 +- .../atlassian/jira/8/8.5.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.12/requirements.txt | 1 + .../atlassian/jira/8/8.5.13/Makefile | 6 +- .../atlassian/jira/8/8.5.13/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.13/requirements.txt | 1 + .../atlassian/jira/8/8.5.14/Makefile | 6 +- .../atlassian/jira/8/8.5.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.14/requirements.txt | 1 + .../atlassian/jira/8/8.5.15/Makefile | 6 +- .../atlassian/jira/8/8.5.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.15/requirements.txt | 1 + .../atlassian/jira/8/8.5.16/Makefile | 6 +- .../atlassian/jira/8/8.5.16/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.16/requirements.txt | 1 + .../atlassian/jira/8/8.5.17/Makefile | 6 +- .../atlassian/jira/8/8.5.17/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.17/requirements.txt | 1 + .../atlassian/jira/8/8.5.18/Makefile | 6 +- .../atlassian/jira/8/8.5.18/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.18/requirements.txt | 1 + .../atlassian/jira/8/8.5.19/Makefile | 6 +- .../atlassian/jira/8/8.5.19/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.19/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.2/Makefile | 6 +- .../atlassian/jira/8/8.5.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.3/Makefile | 6 +- .../atlassian/jira/8/8.5.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.4/Makefile | 6 +- .../atlassian/jira/8/8.5.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.5/Makefile | 6 +- .../atlassian/jira/8/8.5.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.6/Makefile | 6 +- .../atlassian/jira/8/8.5.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.7/Makefile | 6 +- .../atlassian/jira/8/8.5.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.8/Makefile | 6 +- .../atlassian/jira/8/8.5.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.5.9/Makefile | 6 +- .../atlassian/jira/8/8.5.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.5.9/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.6.0/Makefile | 6 +- .../atlassian/jira/8/8.6.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.6.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.6.1/Makefile | 6 +- .../atlassian/jira/8/8.6.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.6.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.7.0/Makefile | 6 +- .../atlassian/jira/8/8.7.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.7.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.7.1/Makefile | 6 +- .../atlassian/jira/8/8.7.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.7.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.8.0/Makefile | 6 +- .../atlassian/jira/8/8.8.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.8.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.8.1/Makefile | 6 +- .../atlassian/jira/8/8.8.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.8.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.9.0/Makefile | 6 +- .../atlassian/jira/8/8.9.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.9.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/8/8.9.1/Makefile | 6 +- .../atlassian/jira/8/8.9.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/8/8.9.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.0.0/Makefile | 6 +- .../atlassian/jira/9/9.0.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.0.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.1.0/Makefile | 6 +- .../atlassian/jira/9/9.1.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.1.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.1.1/Makefile | 6 +- .../atlassian/jira/9/9.1.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.1.1/requirements.txt | 1 + .../atlassian/jira/9/9.10.0/Makefile | 6 +- .../atlassian/jira/9/9.10.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.10.0/requirements.txt | 1 + .../atlassian/jira/9/9.10.1/Makefile | 6 +- .../atlassian/jira/9/9.10.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.10.1/requirements.txt | 1 + .../atlassian/jira/9/9.10.2/Makefile | 6 +- .../atlassian/jira/9/9.10.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.10.2/requirements.txt | 1 + .../atlassian/jira/9/9.11.0/Makefile | 6 +- .../atlassian/jira/9/9.11.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.11.0/requirements.txt | 1 + .../atlassian/jira/9/9.11.1/Makefile | 6 +- .../atlassian/jira/9/9.11.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.11.1/requirements.txt | 1 + .../atlassian/jira/9/9.11.2/Makefile | 6 +- .../atlassian/jira/9/9.11.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.11.2/requirements.txt | 1 + .../atlassian/jira/9/9.11.3/Makefile | 6 +- .../atlassian/jira/9/9.11.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.11.3/requirements.txt | 1 + .../atlassian/jira/9/9.12.0/Makefile | 6 +- .../atlassian/jira/9/9.12.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.12.0/requirements.txt | 1 + .../atlassian/jira/9/9.12.1/Makefile | 6 +- .../atlassian/jira/9/9.12.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.12.1/requirements.txt | 1 + .../atlassian/jira/9/9.12.12/Makefile | 6 +- .../atlassian/jira/9/9.12.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.12.12/requirements.txt | 1 + .../atlassian/jira/9/9.12.2/Makefile | 6 +- .../atlassian/jira/9/9.12.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.12.2/requirements.txt | 1 + .../atlassian/jira/9/9.14.1/Makefile | 6 +- .../atlassian/jira/9/9.14.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.14.1/requirements.txt | 1 + .../atlassian/jira/9/9.16.1/Makefile | 6 +- .../atlassian/jira/9/9.16.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.16.1/requirements.txt | 1 + .../atlassian/jira/9/9.17.1/Makefile | 6 +- .../atlassian/jira/9/9.17.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.17.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.2.0/Makefile | 6 +- .../atlassian/jira/9/9.2.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.2.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.2.1/Makefile | 6 +- .../atlassian/jira/9/9.2.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.2.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.3.0/Makefile | 6 +- .../atlassian/jira/9/9.3.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.3.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.3.1/Makefile | 6 +- .../atlassian/jira/9/9.3.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.3.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.3.2/Makefile | 6 +- .../atlassian/jira/9/9.3.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.3.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.3.3/Makefile | 6 +- .../atlassian/jira/9/9.3.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.3.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.0/Makefile | 6 +- .../atlassian/jira/9/9.4.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.1/Makefile | 6 +- .../atlassian/jira/9/9.4.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.1/requirements.txt | 1 + .../atlassian/jira/9/9.4.10/Makefile | 6 +- .../atlassian/jira/9/9.4.10/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.10/requirements.txt | 1 + .../atlassian/jira/9/9.4.11/Makefile | 6 +- .../atlassian/jira/9/9.4.11/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.11/requirements.txt | 1 + .../atlassian/jira/9/9.4.12/Makefile | 6 +- .../atlassian/jira/9/9.4.12/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.12/requirements.txt | 1 + .../atlassian/jira/9/9.4.14/Makefile | 6 +- .../atlassian/jira/9/9.4.14/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.14/requirements.txt | 1 + .../atlassian/jira/9/9.4.15/Makefile | 6 +- .../atlassian/jira/9/9.4.15/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.15/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.2/Makefile | 6 +- .../atlassian/jira/9/9.4.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.3/Makefile | 6 +- .../atlassian/jira/9/9.4.3/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.3/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.4/Makefile | 6 +- .../atlassian/jira/9/9.4.4/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.4/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.5/Makefile | 6 +- .../atlassian/jira/9/9.4.5/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.5/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.6/Makefile | 6 +- .../atlassian/jira/9/9.4.6/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.6/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.7/Makefile | 6 +- .../atlassian/jira/9/9.4.7/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.7/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.8/Makefile | 6 +- .../atlassian/jira/9/9.4.8/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.8/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.4.9/Makefile | 6 +- .../atlassian/jira/9/9.4.9/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.4.9/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.5.0/Makefile | 6 +- .../atlassian/jira/9/9.5.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.5.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.5.1/Makefile | 6 +- .../atlassian/jira/9/9.5.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.5.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.6.0/Makefile | 6 +- .../atlassian/jira/9/9.6.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.6.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.7.0/Makefile | 6 +- .../atlassian/jira/9/9.7.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.7.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.7.1/Makefile | 6 +- .../atlassian/jira/9/9.7.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.7.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.7.2/Makefile | 6 +- .../atlassian/jira/9/9.7.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.7.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.8.0/Makefile | 6 +- .../atlassian/jira/9/9.8.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.8.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.8.1/Makefile | 6 +- .../atlassian/jira/9/9.8.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.8.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.8.2/Makefile | 6 +- .../atlassian/jira/9/9.8.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.8.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.9.0/Makefile | 6 +- .../atlassian/jira/9/9.9.0/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.9.0/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.9.1/Makefile | 6 +- .../atlassian/jira/9/9.9.1/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.9.1/requirements.txt | 1 + .../ecosystem/atlassian/jira/9/9.9.2/Makefile | 6 +- .../atlassian/jira/9/9.9.2/kaniko-build.py | 196 ------------------ .../atlassian/jira/9/9.9.2/requirements.txt | 1 + .../ecosystem/atlassian/jira/latest/Makefile | 6 +- .../atlassian/jira/latest/kaniko-build.py | 196 ------------------ .../atlassian/jira/latest/requirements.txt | 1 + linux/ecosystem/cassandra/3.11/Makefile | 6 +- .../ecosystem/cassandra/3.11/kaniko-build.py | 196 ------------------ .../ecosystem/cassandra/3.11/requirements.txt | 1 + .../electron-release-server/Makefile | 6 +- .../electron-release-server/kaniko-build.py | 196 ------------------ .../electron-release-server/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/develop/Makefile | 6 +- .../astra/1.7-alse/develop/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/develop/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk11/Makefile | 6 +- .../astra/1.7-alse/jdk11/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk11/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk16/Makefile | 6 +- .../astra/1.7-alse/jdk16/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk16/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk17/Makefile | 6 +- .../astra/1.7-alse/jdk17/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk17/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk18/Makefile | 6 +- .../astra/1.7-alse/jdk18/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk18/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk19/Makefile | 6 +- .../astra/1.7-alse/jdk19/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk19/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk20/Makefile | 6 +- .../astra/1.7-alse/jdk20/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk20/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk21/Makefile | 6 +- .../astra/1.7-alse/jdk21/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk21/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk22/Makefile | 6 +- .../astra/1.7-alse/jdk22/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk22/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk6/Makefile | 6 +- .../astra/1.7-alse/jdk6/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk6/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk7/Makefile | 6 +- .../astra/1.7-alse/jdk7/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk7/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/jdk8/Makefile | 6 +- .../astra/1.7-alse/jdk8/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/jdk8/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/main/Makefile | 6 +- .../astra/1.7-alse/main/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/main/requirements.txt | 1 + .../astra/1.7-alse/python3.10/Makefile | 6 +- .../astra/1.7-alse/python3.10/kaniko-build.py | 196 ------------------ .../1.7-alse/python3.10/requirements.txt | 1 + .../astra/1.7-alse/python3.11/Makefile | 6 +- .../astra/1.7-alse/python3.11/kaniko-build.py | 196 ------------------ .../1.7-alse/python3.11/requirements.txt | 1 + .../astra/1.7-alse/python3.12/Makefile | 6 +- .../astra/1.7-alse/python3.12/kaniko-build.py | 196 ------------------ .../1.7-alse/python3.12/requirements.txt | 1 + .../astra/1.7-alse/python3.13/Makefile | 6 +- .../astra/1.7-alse/python3.13/kaniko-build.py | 196 ------------------ .../1.7-alse/python3.13/requirements.txt | 1 + .../epicmorg/astra/1.7-alse/slim/Makefile | 6 +- .../astra/1.7-alse/slim/kaniko-build.py | 196 ------------------ .../astra/1.7-alse/slim/requirements.txt | 1 + .../debian/06-squeeze/develop/Makefile | 6 +- .../debian/06-squeeze/develop/kaniko-build.py | 196 ------------------ .../06-squeeze/develop/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk11/Makefile | 6 +- .../debian/06-squeeze/jdk11/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk11/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk16/Makefile | 6 +- .../debian/06-squeeze/jdk16/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk16/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk17/Makefile | 6 +- .../debian/06-squeeze/jdk17/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk17/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk18/Makefile | 6 +- .../debian/06-squeeze/jdk18/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk18/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk19/Makefile | 6 +- .../debian/06-squeeze/jdk19/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk19/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk20/Makefile | 6 +- .../debian/06-squeeze/jdk20/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk20/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk21/Makefile | 6 +- .../debian/06-squeeze/jdk21/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk21/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk22/Makefile | 6 +- .../debian/06-squeeze/jdk22/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk22/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk6/Makefile | 6 +- .../debian/06-squeeze/jdk6/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk6/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk7/Makefile | 6 +- .../debian/06-squeeze/jdk7/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk7/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/jdk8/Makefile | 6 +- .../debian/06-squeeze/jdk8/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/jdk8/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/main/Makefile | 6 +- .../debian/06-squeeze/main/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/main/requirements.txt | 1 + .../epicmorg/debian/06-squeeze/slim/Makefile | 6 +- .../debian/06-squeeze/slim/kaniko-build.py | 196 ------------------ .../debian/06-squeeze/slim/requirements.txt | 1 + .../debian/07-wheezy/develop/Makefile | 6 +- .../debian/07-wheezy/develop/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/develop/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk11/Makefile | 6 +- .../debian/07-wheezy/jdk11/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk11/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk16/Makefile | 6 +- .../debian/07-wheezy/jdk16/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk16/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk17/Makefile | 6 +- .../debian/07-wheezy/jdk17/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk17/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk18/Makefile | 6 +- .../debian/07-wheezy/jdk18/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk18/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk19/Makefile | 6 +- .../debian/07-wheezy/jdk19/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk19/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk20/Makefile | 6 +- .../debian/07-wheezy/jdk20/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk20/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk21/Makefile | 6 +- .../debian/07-wheezy/jdk21/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk21/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk22/Makefile | 6 +- .../debian/07-wheezy/jdk22/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk22/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk6/Makefile | 6 +- .../debian/07-wheezy/jdk6/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk6/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk7/Makefile | 6 +- .../debian/07-wheezy/jdk7/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk7/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/jdk8/Makefile | 6 +- .../debian/07-wheezy/jdk8/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/jdk8/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/main/Makefile | 6 +- .../debian/07-wheezy/main/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/main/requirements.txt | 1 + .../epicmorg/debian/07-wheezy/slim/Makefile | 6 +- .../debian/07-wheezy/slim/kaniko-build.py | 196 ------------------ .../debian/07-wheezy/slim/requirements.txt | 1 + .../debian/08-jessie/develop/Makefile | 6 +- .../debian/08-jessie/develop/kaniko-build.py | 196 ------------------ .../debian/08-jessie/develop/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk11/Makefile | 6 +- .../debian/08-jessie/jdk11/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk11/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk16/Makefile | 6 +- .../debian/08-jessie/jdk16/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk16/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk17/Makefile | 6 +- .../debian/08-jessie/jdk17/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk17/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk18/Makefile | 6 +- .../debian/08-jessie/jdk18/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk18/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk19/Makefile | 6 +- .../debian/08-jessie/jdk19/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk19/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk20/Makefile | 6 +- .../debian/08-jessie/jdk20/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk20/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk21/Makefile | 6 +- .../debian/08-jessie/jdk21/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk21/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk22/Makefile | 6 +- .../debian/08-jessie/jdk22/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk22/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk6/Makefile | 6 +- .../debian/08-jessie/jdk6/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk6/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk7/Makefile | 6 +- .../debian/08-jessie/jdk7/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk7/requirements.txt | 1 + .../epicmorg/debian/08-jessie/jdk8/Makefile | 6 +- .../debian/08-jessie/jdk8/kaniko-build.py | 196 ------------------ .../debian/08-jessie/jdk8/requirements.txt | 1 + .../epicmorg/debian/08-jessie/main/Makefile | 6 +- .../debian/08-jessie/main/kaniko-build.py | 196 ------------------ .../debian/08-jessie/main/requirements.txt | 1 + .../epicmorg/debian/08-jessie/slim/Makefile | 6 +- .../debian/08-jessie/slim/kaniko-build.py | 196 ------------------ .../debian/08-jessie/slim/requirements.txt | 1 + .../debian/09-stretch/develop/Makefile | 6 +- .../debian/09-stretch/develop/kaniko-build.py | 196 ------------------ .../09-stretch/develop/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk11/Makefile | 6 +- .../debian/09-stretch/jdk11/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk11/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk16/Makefile | 6 +- .../debian/09-stretch/jdk16/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk16/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk17/Makefile | 6 +- .../debian/09-stretch/jdk17/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk17/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk18/Makefile | 6 +- .../debian/09-stretch/jdk18/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk18/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk19/Makefile | 6 +- .../debian/09-stretch/jdk19/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk19/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk20/Makefile | 6 +- .../debian/09-stretch/jdk20/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk20/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk21/Makefile | 6 +- .../debian/09-stretch/jdk21/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk21/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk22/Makefile | 6 +- .../debian/09-stretch/jdk22/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk22/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk6/Makefile | 6 +- .../debian/09-stretch/jdk6/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk6/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk7/Makefile | 6 +- .../debian/09-stretch/jdk7/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk7/requirements.txt | 1 + .../epicmorg/debian/09-stretch/jdk8/Makefile | 6 +- .../debian/09-stretch/jdk8/kaniko-build.py | 196 ------------------ .../debian/09-stretch/jdk8/requirements.txt | 1 + .../epicmorg/debian/09-stretch/main/Makefile | 6 +- .../debian/09-stretch/main/kaniko-build.py | 196 ------------------ .../debian/09-stretch/main/requirements.txt | 1 + .../epicmorg/debian/09-stretch/slim/Makefile | 6 +- .../debian/09-stretch/slim/kaniko-build.py | 196 ------------------ .../debian/09-stretch/slim/requirements.txt | 1 + .../debian/10-buster/develop/Makefile | 6 +- .../debian/10-buster/develop/kaniko-build.py | 196 ------------------ .../debian/10-buster/develop/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk11/Makefile | 6 +- .../debian/10-buster/jdk11/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk11/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk16/Makefile | 6 +- .../debian/10-buster/jdk16/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk16/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk17/Makefile | 6 +- .../debian/10-buster/jdk17/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk17/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk18/Makefile | 6 +- .../debian/10-buster/jdk18/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk18/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk19/Makefile | 6 +- .../debian/10-buster/jdk19/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk19/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk20/Makefile | 6 +- .../debian/10-buster/jdk20/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk20/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk21/Makefile | 6 +- .../debian/10-buster/jdk21/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk21/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk22/Makefile | 6 +- .../debian/10-buster/jdk22/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk22/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk6/Makefile | 6 +- .../debian/10-buster/jdk6/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk6/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk7/Makefile | 6 +- .../debian/10-buster/jdk7/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk7/requirements.txt | 1 + .../epicmorg/debian/10-buster/jdk8/Makefile | 6 +- .../debian/10-buster/jdk8/kaniko-build.py | 196 ------------------ .../debian/10-buster/jdk8/requirements.txt | 1 + .../epicmorg/debian/10-buster/main/Makefile | 6 +- .../debian/10-buster/main/kaniko-build.py | 196 ------------------ .../debian/10-buster/main/requirements.txt | 1 + .../epicmorg/debian/10-buster/slim/Makefile | 6 +- .../debian/10-buster/slim/kaniko-build.py | 196 ------------------ .../debian/10-buster/slim/requirements.txt | 1 + .../debian/11-bullseye/develop/Makefile | 6 +- .../11-bullseye/develop/kaniko-build.py | 196 ------------------ .../11-bullseye/develop/requirements.txt | 1 + .../debian/11-bullseye/jdk11/Makefile | 6 +- .../debian/11-bullseye/jdk11/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk11/requirements.txt | 1 + .../debian/11-bullseye/jdk16/Makefile | 6 +- .../debian/11-bullseye/jdk16/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk16/requirements.txt | 1 + .../debian/11-bullseye/jdk17/Makefile | 6 +- .../debian/11-bullseye/jdk17/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk17/requirements.txt | 1 + .../debian/11-bullseye/jdk18/Makefile | 6 +- .../debian/11-bullseye/jdk18/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk18/requirements.txt | 1 + .../debian/11-bullseye/jdk19/Makefile | 6 +- .../debian/11-bullseye/jdk19/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk19/requirements.txt | 1 + .../debian/11-bullseye/jdk20/Makefile | 6 +- .../debian/11-bullseye/jdk20/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk20/requirements.txt | 1 + .../debian/11-bullseye/jdk21/Makefile | 6 +- .../debian/11-bullseye/jdk21/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk21/requirements.txt | 1 + .../debian/11-bullseye/jdk22/Makefile | 6 +- .../debian/11-bullseye/jdk22/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk22/requirements.txt | 1 + .../epicmorg/debian/11-bullseye/jdk6/Makefile | 6 +- .../debian/11-bullseye/jdk6/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk6/requirements.txt | 1 + .../epicmorg/debian/11-bullseye/jdk7/Makefile | 6 +- .../debian/11-bullseye/jdk7/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk7/requirements.txt | 1 + .../epicmorg/debian/11-bullseye/jdk8/Makefile | 6 +- .../debian/11-bullseye/jdk8/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/jdk8/requirements.txt | 1 + .../epicmorg/debian/11-bullseye/main/Makefile | 6 +- .../debian/11-bullseye/main/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/main/requirements.txt | 1 + .../epicmorg/debian/11-bullseye/slim/Makefile | 6 +- .../debian/11-bullseye/slim/kaniko-build.py | 196 ------------------ .../debian/11-bullseye/slim/requirements.txt | 1 + .../debian/12-bookworm/develop/Makefile | 6 +- .../12-bookworm/develop/kaniko-build.py | 196 ------------------ .../12-bookworm/develop/requirements.txt | 1 + .../debian/12-bookworm/jdk11/Makefile | 6 +- .../debian/12-bookworm/jdk11/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk11/requirements.txt | 1 + .../debian/12-bookworm/jdk16/Makefile | 6 +- .../debian/12-bookworm/jdk16/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk16/requirements.txt | 1 + .../debian/12-bookworm/jdk17/Makefile | 6 +- .../debian/12-bookworm/jdk17/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk17/requirements.txt | 1 + .../debian/12-bookworm/jdk18/Makefile | 6 +- .../debian/12-bookworm/jdk18/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk18/requirements.txt | 1 + .../debian/12-bookworm/jdk19/Makefile | 6 +- .../debian/12-bookworm/jdk19/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk19/requirements.txt | 1 + .../debian/12-bookworm/jdk20/Makefile | 6 +- .../debian/12-bookworm/jdk20/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk20/requirements.txt | 1 + .../debian/12-bookworm/jdk21/Makefile | 6 +- .../debian/12-bookworm/jdk21/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk21/requirements.txt | 1 + .../debian/12-bookworm/jdk22/Makefile | 6 +- .../debian/12-bookworm/jdk22/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk22/requirements.txt | 1 + .../epicmorg/debian/12-bookworm/jdk6/Makefile | 6 +- .../debian/12-bookworm/jdk6/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk6/requirements.txt | 1 + .../epicmorg/debian/12-bookworm/jdk7/Makefile | 6 +- .../debian/12-bookworm/jdk7/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk7/requirements.txt | 1 + .../epicmorg/debian/12-bookworm/jdk8/Makefile | 6 +- .../debian/12-bookworm/jdk8/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/jdk8/requirements.txt | 1 + .../epicmorg/debian/12-bookworm/main/Makefile | 6 +- .../debian/12-bookworm/main/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/main/requirements.txt | 1 + .../epicmorg/debian/12-bookworm/slim/Makefile | 6 +- .../debian/12-bookworm/slim/kaniko-build.py | 196 ------------------ .../debian/12-bookworm/slim/requirements.txt | 1 + .../gitlab/runner/amxx-sdk/1.10/Makefile | 6 +- .../runner/amxx-sdk/1.10/kaniko-build.py | 196 ------------------ .../runner/amxx-sdk/1.10/requirements.txt | 1 + .../gitlab/runner/amxx-sdk/1.9/Makefile | 6 +- .../runner/amxx-sdk/1.9/kaniko-build.py | 196 ------------------ .../runner/amxx-sdk/1.9/requirements.txt | 1 + .../gitlab/runner/android-sdk/jdk11/Makefile | 6 +- .../runner/android-sdk/jdk11/kaniko-build.py | 196 ------------------ .../runner/android-sdk/jdk11/requirements.txt | 1 + .../gitlab/runner/android-sdk/jdk17/Makefile | 6 +- .../runner/android-sdk/jdk17/kaniko-build.py | 196 ------------------ .../runner/android-sdk/jdk17/requirements.txt | 1 + .../gitlab/runner/android-sdk/jdk8/Makefile | 6 +- .../runner/android-sdk/jdk8/kaniko-build.py | 196 ------------------ .../runner/android-sdk/jdk8/requirements.txt | 1 + .../gitlab/runner/atlassian-sdk/Makefile | 6 +- .../runner/atlassian-sdk/kaniko-build.py | 196 ------------------ .../runner/atlassian-sdk/requirements.txt | 1 + .../gitlab/runner/dotnet-sdk/Makefile | 6 +- .../gitlab/runner/dotnet-sdk/kaniko-build.py | 196 ------------------ .../gitlab/runner/dotnet-sdk/requirements.txt | 1 + linux/ecosystem/gitlab/runner/latest/Makefile | 6 +- .../gitlab/runner/latest/kaniko-build.py | 196 ------------------ .../gitlab/runner/latest/requirements.txt | 1 + .../ecosystem/gitlab/runner/node0.12/Makefile | 6 +- .../gitlab/runner/node0.12/kaniko-build.py | 196 ------------------ .../gitlab/runner/node0.12/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node10/Makefile | 6 +- .../gitlab/runner/node10/kaniko-build.py | 196 ------------------ .../gitlab/runner/node10/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node11/Makefile | 6 +- .../gitlab/runner/node11/kaniko-build.py | 196 ------------------ .../gitlab/runner/node11/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node12/Makefile | 6 +- .../gitlab/runner/node12/kaniko-build.py | 196 ------------------ .../gitlab/runner/node12/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node13/Makefile | 6 +- .../gitlab/runner/node13/kaniko-build.py | 196 ------------------ .../gitlab/runner/node13/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node14/Makefile | 6 +- .../gitlab/runner/node14/kaniko-build.py | 196 ------------------ .../gitlab/runner/node14/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node15/Makefile | 6 +- .../gitlab/runner/node15/kaniko-build.py | 196 ------------------ .../gitlab/runner/node15/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node16/Makefile | 6 +- .../gitlab/runner/node16/kaniko-build.py | 196 ------------------ .../gitlab/runner/node16/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node17/Makefile | 6 +- .../gitlab/runner/node17/kaniko-build.py | 196 ------------------ .../gitlab/runner/node17/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node18/Makefile | 6 +- .../gitlab/runner/node18/kaniko-build.py | 196 ------------------ .../gitlab/runner/node18/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node19/Makefile | 6 +- .../gitlab/runner/node19/kaniko-build.py | 196 ------------------ .../gitlab/runner/node19/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node20/Makefile | 6 +- .../gitlab/runner/node20/kaniko-build.py | 196 ------------------ .../gitlab/runner/node20/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node21/Makefile | 6 +- .../gitlab/runner/node21/kaniko-build.py | 196 ------------------ .../gitlab/runner/node21/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node22/Makefile | 6 +- .../gitlab/runner/node22/kaniko-build.py | 196 ------------------ .../gitlab/runner/node22/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node4/Makefile | 6 +- .../gitlab/runner/node4/kaniko-build.py | 196 ------------------ .../gitlab/runner/node4/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node5/Makefile | 6 +- .../gitlab/runner/node5/kaniko-build.py | 196 ------------------ .../gitlab/runner/node5/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node6/Makefile | 6 +- .../gitlab/runner/node6/kaniko-build.py | 196 ------------------ .../gitlab/runner/node6/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node7/Makefile | 6 +- .../gitlab/runner/node7/kaniko-build.py | 196 ------------------ .../gitlab/runner/node7/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node8/Makefile | 6 +- .../gitlab/runner/node8/kaniko-build.py | 196 ------------------ .../gitlab/runner/node8/requirements.txt | 1 + linux/ecosystem/gitlab/runner/node9/Makefile | 6 +- .../gitlab/runner/node9/kaniko-build.py | 196 ------------------ .../gitlab/runner/node9/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php7.2/Makefile | 6 +- .../gitlab/runner/php7.2/kaniko-build.py | 196 ------------------ .../gitlab/runner/php7.2/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php7.3/Makefile | 6 +- .../gitlab/runner/php7.3/kaniko-build.py | 196 ------------------ .../gitlab/runner/php7.3/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php7.4/Makefile | 6 +- .../gitlab/runner/php7.4/kaniko-build.py | 196 ------------------ .../gitlab/runner/php7.4/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php8.0/Makefile | 6 +- .../gitlab/runner/php8.0/kaniko-build.py | 196 ------------------ .../gitlab/runner/php8.0/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php8.1/Makefile | 6 +- .../gitlab/runner/php8.1/kaniko-build.py | 196 ------------------ .../gitlab/runner/php8.1/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php8.2/Makefile | 6 +- .../gitlab/runner/php8.2/kaniko-build.py | 196 ------------------ .../gitlab/runner/php8.2/requirements.txt | 1 + linux/ecosystem/gitlab/runner/php8.3/Makefile | 6 +- .../gitlab/runner/php8.3/kaniko-build.py | 196 ------------------ .../gitlab/runner/php8.3/requirements.txt | 1 + .../gitlab/runner/steam-sdk/Makefile | 6 +- .../gitlab/runner/steam-sdk/kaniko-build.py | 196 ------------------ .../gitlab/runner/steam-sdk/requirements.txt | 1 + linux/ecosystem/monero/monerod/Makefile | 6 +- .../ecosystem/monero/monerod/kaniko-build.py | 196 ------------------ .../ecosystem/monero/monerod/requirements.txt | 1 + linux/ecosystem/monero/p2pool/Makefile | 6 +- linux/ecosystem/monero/p2pool/kaniko-build.py | 196 ------------------ .../ecosystem/monero/p2pool/requirements.txt | 1 + linux/ecosystem/nginx/1.14.2/main/Makefile | 6 +- .../nginx/1.14.2/main/kaniko-build.py | 196 ------------------ .../nginx/1.14.2/main/requirements.txt | 1 + linux/ecosystem/nginx/1.14.2/php/Makefile | 6 +- .../nginx/1.14.2/php/kaniko-build.py | 196 ------------------ .../nginx/1.14.2/php/requirements.txt | 1 + .../ecosystem/nginx/1.14.2/rtmp-hls/Makefile | 6 +- .../nginx/1.14.2/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.14.2/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.15.12/main/Makefile | 6 +- .../nginx/1.15.12/main/kaniko-build.py | 196 ------------------ .../nginx/1.15.12/main/requirements.txt | 1 + linux/ecosystem/nginx/1.15.12/php/Makefile | 6 +- .../nginx/1.15.12/php/kaniko-build.py | 196 ------------------ .../nginx/1.15.12/php/requirements.txt | 1 + .../ecosystem/nginx/1.15.12/rtmp-hls/Makefile | 6 +- .../nginx/1.15.12/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.15.12/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.16.1/main/Makefile | 6 +- .../nginx/1.16.1/main/kaniko-build.py | 196 ------------------ .../nginx/1.16.1/main/requirements.txt | 1 + linux/ecosystem/nginx/1.16.1/php/Makefile | 6 +- .../nginx/1.16.1/php/kaniko-build.py | 196 ------------------ .../nginx/1.16.1/php/requirements.txt | 1 + .../ecosystem/nginx/1.16.1/rtmp-hls/Makefile | 6 +- .../nginx/1.16.1/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.16.1/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.17.10/main/Makefile | 6 +- .../nginx/1.17.10/main/kaniko-build.py | 196 ------------------ .../nginx/1.17.10/main/requirements.txt | 1 + linux/ecosystem/nginx/1.17.10/php/Makefile | 6 +- .../nginx/1.17.10/php/kaniko-build.py | 196 ------------------ .../nginx/1.17.10/php/requirements.txt | 1 + .../ecosystem/nginx/1.17.10/rtmp-hls/Makefile | 6 +- .../nginx/1.17.10/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.17.10/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.18.0/main/Makefile | 6 +- .../nginx/1.18.0/main/kaniko-build.py | 196 ------------------ .../nginx/1.18.0/main/requirements.txt | 1 + linux/ecosystem/nginx/1.18.0/php/Makefile | 6 +- .../nginx/1.18.0/php/kaniko-build.py | 196 ------------------ .../nginx/1.18.0/php/requirements.txt | 1 + .../ecosystem/nginx/1.18.0/rtmp-hls/Makefile | 6 +- .../nginx/1.18.0/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.18.0/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.19.10/main/Makefile | 6 +- .../nginx/1.19.10/main/kaniko-build.py | 196 ------------------ .../nginx/1.19.10/main/requirements.txt | 1 + linux/ecosystem/nginx/1.19.10/php/Makefile | 6 +- .../nginx/1.19.10/php/kaniko-build.py | 196 ------------------ .../nginx/1.19.10/php/requirements.txt | 1 + .../ecosystem/nginx/1.19.10/rtmp-hls/Makefile | 6 +- .../nginx/1.19.10/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.19.10/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.20.1/main/Makefile | 6 +- .../nginx/1.20.1/main/kaniko-build.py | 196 ------------------ .../nginx/1.20.1/main/requirements.txt | 1 + linux/ecosystem/nginx/1.20.1/php/Makefile | 6 +- .../nginx/1.20.1/php/kaniko-build.py | 196 ------------------ .../nginx/1.20.1/php/requirements.txt | 1 + .../ecosystem/nginx/1.20.1/rtmp-hls/Makefile | 6 +- .../nginx/1.20.1/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.20.1/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.21.3/main/Makefile | 6 +- .../nginx/1.21.3/main/kaniko-build.py | 196 ------------------ .../nginx/1.21.3/main/requirements.txt | 1 + linux/ecosystem/nginx/1.21.3/php/Makefile | 6 +- .../nginx/1.21.3/php/kaniko-build.py | 196 ------------------ .../nginx/1.21.3/php/requirements.txt | 1 + .../ecosystem/nginx/1.21.3/rtmp-hls/Makefile | 6 +- .../nginx/1.21.3/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.21.3/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.21.6/main/Makefile | 6 +- .../nginx/1.21.6/main/kaniko-build.py | 196 ------------------ .../nginx/1.21.6/main/requirements.txt | 1 + linux/ecosystem/nginx/1.21.6/php/Makefile | 6 +- .../nginx/1.21.6/php/kaniko-build.py | 196 ------------------ .../nginx/1.21.6/php/requirements.txt | 1 + .../ecosystem/nginx/1.21.6/rtmp-hls/Makefile | 6 +- .../nginx/1.21.6/rtmp-hls/kaniko-build.py | 196 ------------------ .../nginx/1.21.6/rtmp-hls/requirements.txt | 1 + linux/ecosystem/nginx/1.27.0/main/Makefile | 6 +- .../nginx/1.27.0/main/etc/nginx/nginx.conf | 9 +- .../nginx/1.27.0/main/kaniko-build.py | 196 ------------------ .../nginx/1.27.0/main/requirements.txt | 1 + .../nginx/latest/mainline/main/Makefile | 4 +- .../latest/mainline/main/kaniko-build.py | 196 ------------------ .../latest/mainline/main/requirements.txt | 1 + .../nginx/latest/mainline/php/Makefile | 6 +- .../nginx/latest/mainline/php/kaniko-build.py | 196 ------------------ .../latest/mainline/php/requirements.txt | 1 + .../nginx/latest/mainline/rtmp-hls/Makefile | 6 +- .../latest/mainline/rtmp-hls/kaniko-build.py | 196 ------------------ .../latest/mainline/rtmp-hls/requirements.txt | 1 + .../ecosystem/nginx/latest/quic/main/Makefile | 6 +- .../nginx/latest/quic/main/kaniko-build.py | 196 ------------------ .../nginx/latest/quic/main/requirements.txt | 1 + .../ecosystem/nginx/latest/quic/php/Makefile | 6 +- .../nginx/latest/quic/php/kaniko-build.py | 196 ------------------ .../nginx/latest/quic/php/requirements.txt | 1 + .../nginx/latest/quic/rtmp-hls/Makefile | 6 +- .../latest/quic/rtmp-hls/kaniko-build.py | 196 ------------------ .../latest/quic/rtmp-hls/requirements.txt | 1 + linux/ecosystem/ninjam/latest/Makefile | 6 +- linux/ecosystem/ninjam/latest/kaniko-build.py | 196 ------------------ .../ecosystem/ninjam/latest/requirements.txt | 1 + linux/ecosystem/nodejs/current/Makefile | 6 +- .../ecosystem/nodejs/current/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/current/requirements.txt | 1 + linux/ecosystem/nodejs/lts/Makefile | 6 +- linux/ecosystem/nodejs/lts/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/lts/requirements.txt | 1 + linux/ecosystem/nodejs/node0.12/Makefile | 6 +- .../ecosystem/nodejs/node0.12/kaniko-build.py | 196 ------------------ .../nodejs/node0.12/requirements.txt | 1 + linux/ecosystem/nodejs/node10/Makefile | 6 +- linux/ecosystem/nodejs/node10/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node10/requirements.txt | 1 + linux/ecosystem/nodejs/node11/Makefile | 6 +- linux/ecosystem/nodejs/node11/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node11/requirements.txt | 1 + linux/ecosystem/nodejs/node12/Makefile | 6 +- linux/ecosystem/nodejs/node12/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node12/requirements.txt | 1 + linux/ecosystem/nodejs/node13/Makefile | 6 +- linux/ecosystem/nodejs/node13/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node13/requirements.txt | 1 + linux/ecosystem/nodejs/node14/Makefile | 6 +- linux/ecosystem/nodejs/node14/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node14/requirements.txt | 1 + linux/ecosystem/nodejs/node15/Makefile | 6 +- linux/ecosystem/nodejs/node15/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node15/requirements.txt | 1 + linux/ecosystem/nodejs/node16/Makefile | 6 +- linux/ecosystem/nodejs/node16/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node16/requirements.txt | 1 + linux/ecosystem/nodejs/node17/Makefile | 6 +- linux/ecosystem/nodejs/node17/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node17/requirements.txt | 1 + linux/ecosystem/nodejs/node18/Makefile | 6 +- linux/ecosystem/nodejs/node18/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node18/requirements.txt | 1 + linux/ecosystem/nodejs/node19/Makefile | 6 +- linux/ecosystem/nodejs/node19/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node19/requirements.txt | 1 + linux/ecosystem/nodejs/node20/Makefile | 6 +- linux/ecosystem/nodejs/node20/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node20/requirements.txt | 1 + linux/ecosystem/nodejs/node21/Makefile | 6 +- linux/ecosystem/nodejs/node21/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node21/requirements.txt | 1 + linux/ecosystem/nodejs/node22/Makefile | 6 +- linux/ecosystem/nodejs/node22/kaniko-build.py | 196 ------------------ .../ecosystem/nodejs/node22/requirements.txt | 1 + linux/ecosystem/nodejs/node4/Makefile | 6 +- linux/ecosystem/nodejs/node4/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/node4/requirements.txt | 1 + linux/ecosystem/nodejs/node5/Makefile | 6 +- linux/ecosystem/nodejs/node5/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/node5/requirements.txt | 1 + linux/ecosystem/nodejs/node6/Makefile | 6 +- linux/ecosystem/nodejs/node6/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/node6/requirements.txt | 1 + linux/ecosystem/nodejs/node7/Makefile | 6 +- linux/ecosystem/nodejs/node7/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/node7/requirements.txt | 1 + linux/ecosystem/nodejs/node8/Makefile | 6 +- linux/ecosystem/nodejs/node8/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/node8/requirements.txt | 1 + linux/ecosystem/nodejs/node9/Makefile | 6 +- linux/ecosystem/nodejs/node9/kaniko-build.py | 196 ------------------ linux/ecosystem/nodejs/node9/requirements.txt | 1 + linux/ecosystem/opentracker/Makefile | 6 +- linux/ecosystem/opentracker/kaniko-build.py | 196 ------------------ linux/ecosystem/opentracker/requirements.txt | 1 + linux/ecosystem/perforce/base/r16.2/Makefile | 6 +- .../perforce/base/r16.2/kaniko-build.py | 196 ------------------ .../perforce/base/r16.2/requirements.txt | 1 + linux/ecosystem/perforce/base/r17.1/Makefile | 6 +- .../perforce/base/r17.1/kaniko-build.py | 196 ------------------ .../perforce/base/r17.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r17.2/Makefile | 6 +- .../perforce/base/r17.2/kaniko-build.py | 196 ------------------ .../perforce/base/r17.2/requirements.txt | 1 + linux/ecosystem/perforce/base/r18.1/Makefile | 6 +- .../perforce/base/r18.1/kaniko-build.py | 196 ------------------ .../perforce/base/r18.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r18.2/Makefile | 6 +- .../perforce/base/r18.2/kaniko-build.py | 196 ------------------ .../perforce/base/r18.2/requirements.txt | 1 + linux/ecosystem/perforce/base/r19.1/Makefile | 6 +- .../perforce/base/r19.1/kaniko-build.py | 196 ------------------ .../perforce/base/r19.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r19.2/Makefile | 6 +- .../perforce/base/r19.2/kaniko-build.py | 196 ------------------ .../perforce/base/r19.2/requirements.txt | 1 + linux/ecosystem/perforce/base/r20.1/Makefile | 6 +- .../perforce/base/r20.1/kaniko-build.py | 196 ------------------ .../perforce/base/r20.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r20.2/Makefile | 6 +- .../perforce/base/r20.2/kaniko-build.py | 196 ------------------ .../perforce/base/r20.2/requirements.txt | 1 + linux/ecosystem/perforce/base/r21.1/Makefile | 6 +- .../perforce/base/r21.1/kaniko-build.py | 196 ------------------ .../perforce/base/r21.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r21.2/Makefile | 6 +- .../perforce/base/r21.2/kaniko-build.py | 196 ------------------ .../perforce/base/r21.2/requirements.txt | 1 + linux/ecosystem/perforce/base/r22.1/Makefile | 6 +- .../perforce/base/r22.1/kaniko-build.py | 196 ------------------ .../perforce/base/r22.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r23.1/Makefile | 6 +- .../perforce/base/r23.1/kaniko-build.py | 196 ------------------ .../perforce/base/r23.1/requirements.txt | 1 + linux/ecosystem/perforce/base/r23.2/Makefile | 6 +- .../perforce/base/r23.2/kaniko-build.py | 196 ------------------ .../perforce/base/r23.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r16.2/Makefile | 6 +- .../perforce/p4p/r16.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r16.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r17.1/Makefile | 6 +- .../perforce/p4p/r17.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r17.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r17.2/Makefile | 6 +- .../perforce/p4p/r17.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r17.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r18.1/Makefile | 6 +- .../perforce/p4p/r18.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r18.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r18.2/Makefile | 6 +- .../perforce/p4p/r18.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r18.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r19.1/Makefile | 6 +- .../perforce/p4p/r19.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r19.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r19.2/Makefile | 6 +- .../perforce/p4p/r19.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r19.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r20.1/Makefile | 6 +- .../perforce/p4p/r20.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r20.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r20.2/Makefile | 6 +- .../perforce/p4p/r20.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r20.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r21.1/Makefile | 6 +- .../perforce/p4p/r21.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r21.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r21.2/Makefile | 6 +- .../perforce/p4p/r21.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r21.2/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r22.1/Makefile | 6 +- .../perforce/p4p/r22.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r22.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r23.1/Makefile | 6 +- .../perforce/p4p/r23.1/kaniko-build.py | 196 ------------------ .../perforce/p4p/r23.1/requirements.txt | 1 + linux/ecosystem/perforce/p4p/r23.2/Makefile | 6 +- .../perforce/p4p/r23.2/kaniko-build.py | 196 ------------------ .../perforce/p4p/r23.2/requirements.txt | 1 + linux/ecosystem/php/php5.5/Makefile | 6 +- linux/ecosystem/php/php5.5/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php5.5/requirements.txt | 1 + linux/ecosystem/php/php7.0/Makefile | 6 +- linux/ecosystem/php/php7.0/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php7.0/requirements.txt | 1 + linux/ecosystem/php/php7.1/Makefile | 6 +- linux/ecosystem/php/php7.1/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php7.1/requirements.txt | 1 + linux/ecosystem/php/php7.2/Makefile | 6 +- linux/ecosystem/php/php7.2/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php7.2/requirements.txt | 1 + linux/ecosystem/php/php7.3/Makefile | 6 +- linux/ecosystem/php/php7.3/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php7.3/requirements.txt | 1 + linux/ecosystem/php/php7.4/Makefile | 6 +- linux/ecosystem/php/php7.4/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php7.4/requirements.txt | 1 + linux/ecosystem/php/php8.0/Makefile | 6 +- linux/ecosystem/php/php8.0/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php8.0/requirements.txt | 1 + linux/ecosystem/php/php8.1/Makefile | 6 +- linux/ecosystem/php/php8.1/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php8.1/requirements.txt | 1 + linux/ecosystem/php/php8.2/Makefile | 6 +- linux/ecosystem/php/php8.2/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php8.2/requirements.txt | 1 + linux/ecosystem/php/php8.3/Makefile | 6 +- linux/ecosystem/php/php8.3/kaniko-build.py | 196 ------------------ linux/ecosystem/php/php8.3/requirements.txt | 1 + linux/ecosystem/postgres/10/Makefile | 6 +- linux/ecosystem/postgres/10/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/10/requirements.txt | 1 + linux/ecosystem/postgres/11/Makefile | 6 +- linux/ecosystem/postgres/11/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/11/requirements.txt | 1 + linux/ecosystem/postgres/12/Makefile | 6 +- linux/ecosystem/postgres/12/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/12/requirements.txt | 1 + linux/ecosystem/postgres/13/Makefile | 6 +- linux/ecosystem/postgres/13/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/13/requirements.txt | 1 + linux/ecosystem/postgres/14/Makefile | 6 +- linux/ecosystem/postgres/14/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/14/requirements.txt | 1 + linux/ecosystem/postgres/15/Makefile | 6 +- linux/ecosystem/postgres/15/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/15/requirements.txt | 1 + linux/ecosystem/postgres/16/Makefile | 6 +- linux/ecosystem/postgres/16/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/16/requirements.txt | 1 + linux/ecosystem/postgres/8.2/Makefile | 6 +- linux/ecosystem/postgres/8.2/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/8.2/requirements.txt | 1 + linux/ecosystem/postgres/8.3/Makefile | 6 +- linux/ecosystem/postgres/8.3/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/8.3/requirements.txt | 1 + linux/ecosystem/postgres/8.4/Makefile | 6 +- linux/ecosystem/postgres/8.4/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/8.4/requirements.txt | 1 + linux/ecosystem/postgres/9.0/Makefile | 6 +- linux/ecosystem/postgres/9.0/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.0/requirements.txt | 1 + linux/ecosystem/postgres/9.1/Makefile | 6 +- linux/ecosystem/postgres/9.1/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.1/requirements.txt | 1 + linux/ecosystem/postgres/9.2/Makefile | 6 +- linux/ecosystem/postgres/9.2/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.2/requirements.txt | 1 + linux/ecosystem/postgres/9.3/Makefile | 6 +- linux/ecosystem/postgres/9.3/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.3/requirements.txt | 1 + linux/ecosystem/postgres/9.4/Makefile | 6 +- linux/ecosystem/postgres/9.4/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.4/requirements.txt | 1 + linux/ecosystem/postgres/9.5/Makefile | 6 +- linux/ecosystem/postgres/9.5/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.5/requirements.txt | 1 + linux/ecosystem/postgres/9.6/Makefile | 6 +- linux/ecosystem/postgres/9.6/kaniko-build.py | 196 ------------------ linux/ecosystem/postgres/9.6/requirements.txt | 1 + linux/ecosystem/postgres/latest/Makefile | 6 +- .../ecosystem/postgres/latest/kaniko-build.py | 196 ------------------ .../postgres/latest/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.4.0/Makefile | 2 +- .../qbittorrent/4.4.0/kaniko-build.py | 196 ------------------ .../qbittorrent/4.4.0/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.4.1/Makefile | 2 +- .../qbittorrent/4.4.1/kaniko-build.py | 196 ------------------ .../qbittorrent/4.4.1/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.4.2/Makefile | 2 +- .../qbittorrent/4.4.2/kaniko-build.py | 196 ------------------ .../qbittorrent/4.4.2/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.4.3.1/Makefile | 2 +- .../qbittorrent/4.4.3.1/kaniko-build.py | 196 ------------------ .../qbittorrent/4.4.3.1/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.4.4/Makefile | 2 +- .../qbittorrent/4.4.4/kaniko-build.py | 196 ------------------ .../qbittorrent/4.4.4/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.4.5/Makefile | 2 +- .../qbittorrent/4.4.5/kaniko-build.py | 196 ------------------ .../qbittorrent/4.4.5/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.5.0/Makefile | 2 +- .../qbittorrent/4.5.0/kaniko-build.py | 196 ------------------ .../qbittorrent/4.5.0/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.5.1/Makefile | 2 +- .../qbittorrent/4.5.1/kaniko-build.py | 196 ------------------ .../qbittorrent/4.5.1/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.5.2/Makefile | 2 +- .../qbittorrent/4.5.2/kaniko-build.py | 196 ------------------ .../qbittorrent/4.5.2/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.5.3/Makefile | 2 +- .../qbittorrent/4.5.3/kaniko-build.py | 196 ------------------ .../qbittorrent/4.5.3/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.5.4/Makefile | 2 +- .../qbittorrent/4.5.4/kaniko-build.py | 196 ------------------ .../qbittorrent/4.5.4/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.5.5/Makefile | 2 +- .../qbittorrent/4.5.5/kaniko-build.py | 196 ------------------ .../qbittorrent/4.5.5/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.6.0/Makefile | 2 +- .../qbittorrent/4.6.0/kaniko-build.py | 196 ------------------ .../qbittorrent/4.6.0/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.6.1/Makefile | 2 +- .../qbittorrent/4.6.1/kaniko-build.py | 196 ------------------ .../qbittorrent/4.6.1/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.6.2/Makefile | 2 +- .../qbittorrent/4.6.2/kaniko-build.py | 196 ------------------ .../qbittorrent/4.6.2/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.6.3/Makefile | 2 +- .../qbittorrent/4.6.3/kaniko-build.py | 196 ------------------ .../qbittorrent/4.6.3/requirements.txt | 1 + linux/ecosystem/qbittorrent/4.6.4/Makefile | 2 +- .../qbittorrent/4.6.4/kaniko-build.py | 196 ------------------ .../qbittorrent/4.6.4/requirements.txt | 1 + linux/ecosystem/qbittorrent/testing/Makefile | 2 +- .../qbittorrent/testing/kaniko-build.py | 196 ------------------ .../qbittorrent/testing/requirements.txt | 1 + linux/ecosystem/retracker/Makefile | 6 +- linux/ecosystem/retracker/kaniko-build.py | 196 ------------------ linux/ecosystem/retracker/requirements.txt | 1 + .../teamcity/agent/amxx-sdk/1.10/Makefile | 6 +- .../agent/amxx-sdk/1.10/kaniko-build.py | 196 ------------------ .../agent/amxx-sdk/1.10/requirements.txt | 1 + .../teamcity/agent/amxx-sdk/1.9/Makefile | 6 +- .../agent/amxx-sdk/1.9/kaniko-build.py | 196 ------------------ .../agent/amxx-sdk/1.9/requirements.txt | 1 + .../teamcity/agent/android-sdk/jdk11/Makefile | 6 +- .../agent/android-sdk/jdk11/kaniko-build.py | 196 ------------------ .../agent/android-sdk/jdk11/requirements.txt | 1 + .../teamcity/agent/android-sdk/jdk17/Makefile | 6 +- .../agent/android-sdk/jdk17/kaniko-build.py | 196 ------------------ .../agent/android-sdk/jdk17/requirements.txt | 1 + .../teamcity/agent/android-sdk/jdk8/Makefile | 6 +- .../agent/android-sdk/jdk8/kaniko-build.py | 196 ------------------ .../agent/android-sdk/jdk8/requirements.txt | 1 + .../teamcity/agent/atlassian-sdk/Makefile | 6 +- .../agent/atlassian-sdk/kaniko-build.py | 196 ------------------ .../agent/atlassian-sdk/requirements.txt | 1 + .../teamcity/agent/dotnet-sdk/Makefile | 6 +- .../teamcity/agent/dotnet-sdk/kaniko-build.py | 196 ------------------ .../agent/dotnet-sdk/requirements.txt | 1 + .../teamcity/agent/latest/jdk11/Makefile | 6 +- .../agent/latest/jdk11/kaniko-build.py | 196 ------------------ .../agent/latest/jdk11/requirements.txt | 1 + .../teamcity/agent/latest/jdk17/Makefile | 6 +- .../agent/latest/jdk17/kaniko-build.py | 196 ------------------ .../agent/latest/jdk17/requirements.txt | 1 + .../teamcity/agent/latest/jdk21/Makefile | 6 +- .../agent/latest/jdk21/kaniko-build.py | 196 ------------------ .../agent/latest/jdk21/requirements.txt | 1 + .../teamcity/agent/latest/jdk8/Makefile | 6 +- .../agent/latest/jdk8/kaniko-build.py | 196 ------------------ .../agent/latest/jdk8/requirements.txt | 1 + .../teamcity/agent/node0.12/Makefile | 6 +- .../teamcity/agent/node0.12/kaniko-build.py | 196 ------------------ .../teamcity/agent/node0.12/requirements.txt | 1 + .../ecosystem/teamcity/agent/node10/Makefile | 6 +- .../teamcity/agent/node10/kaniko-build.py | 196 ------------------ .../teamcity/agent/node10/requirements.txt | 1 + .../ecosystem/teamcity/agent/node11/Makefile | 6 +- .../teamcity/agent/node11/kaniko-build.py | 196 ------------------ .../teamcity/agent/node11/requirements.txt | 1 + .../ecosystem/teamcity/agent/node12/Makefile | 6 +- .../teamcity/agent/node12/kaniko-build.py | 196 ------------------ .../teamcity/agent/node12/requirements.txt | 1 + .../ecosystem/teamcity/agent/node13/Makefile | 6 +- .../teamcity/agent/node13/kaniko-build.py | 196 ------------------ .../teamcity/agent/node13/requirements.txt | 1 + .../ecosystem/teamcity/agent/node14/Makefile | 6 +- .../teamcity/agent/node14/kaniko-build.py | 196 ------------------ .../teamcity/agent/node14/requirements.txt | 1 + .../ecosystem/teamcity/agent/node15/Makefile | 6 +- .../teamcity/agent/node15/kaniko-build.py | 196 ------------------ .../teamcity/agent/node15/requirements.txt | 1 + .../ecosystem/teamcity/agent/node16/Makefile | 6 +- .../teamcity/agent/node16/kaniko-build.py | 196 ------------------ .../teamcity/agent/node16/requirements.txt | 1 + .../ecosystem/teamcity/agent/node17/Makefile | 6 +- .../teamcity/agent/node17/kaniko-build.py | 196 ------------------ .../teamcity/agent/node17/requirements.txt | 1 + .../ecosystem/teamcity/agent/node18/Makefile | 6 +- .../teamcity/agent/node18/kaniko-build.py | 196 ------------------ .../teamcity/agent/node18/requirements.txt | 1 + .../ecosystem/teamcity/agent/node19/Makefile | 6 +- .../teamcity/agent/node19/kaniko-build.py | 196 ------------------ .../teamcity/agent/node19/requirements.txt | 1 + .../ecosystem/teamcity/agent/node20/Makefile | 6 +- .../teamcity/agent/node20/kaniko-build.py | 196 ------------------ .../teamcity/agent/node20/requirements.txt | 1 + .../ecosystem/teamcity/agent/node21/Makefile | 6 +- .../teamcity/agent/node21/kaniko-build.py | 196 ------------------ .../teamcity/agent/node21/requirements.txt | 1 + .../ecosystem/teamcity/agent/node22/Makefile | 6 +- .../teamcity/agent/node22/kaniko-build.py | 196 ------------------ .../teamcity/agent/node22/requirements.txt | 1 + linux/ecosystem/teamcity/agent/node4/Makefile | 6 +- .../teamcity/agent/node4/kaniko-build.py | 196 ------------------ .../teamcity/agent/node4/requirements.txt | 1 + linux/ecosystem/teamcity/agent/node5/Makefile | 6 +- .../teamcity/agent/node5/kaniko-build.py | 196 ------------------ .../teamcity/agent/node5/requirements.txt | 1 + linux/ecosystem/teamcity/agent/node6/Makefile | 6 +- .../teamcity/agent/node6/kaniko-build.py | 196 ------------------ .../teamcity/agent/node6/requirements.txt | 1 + linux/ecosystem/teamcity/agent/node7/Makefile | 6 +- .../teamcity/agent/node7/kaniko-build.py | 196 ------------------ .../teamcity/agent/node7/requirements.txt | 1 + linux/ecosystem/teamcity/agent/node8/Makefile | 6 +- .../teamcity/agent/node8/kaniko-build.py | 196 ------------------ .../teamcity/agent/node8/requirements.txt | 1 + linux/ecosystem/teamcity/agent/node9/Makefile | 6 +- .../teamcity/agent/node9/kaniko-build.py | 196 ------------------ .../teamcity/agent/node9/requirements.txt | 1 + .../ecosystem/teamcity/agent/php7.2/Makefile | 6 +- .../teamcity/agent/php7.2/kaniko-build.py | 196 ------------------ .../teamcity/agent/php7.2/requirements.txt | 1 + .../ecosystem/teamcity/agent/php7.3/Makefile | 6 +- .../teamcity/agent/php7.3/kaniko-build.py | 196 ------------------ .../teamcity/agent/php7.3/requirements.txt | 1 + .../ecosystem/teamcity/agent/php7.4/Makefile | 6 +- .../teamcity/agent/php7.4/kaniko-build.py | 196 ------------------ .../teamcity/agent/php7.4/requirements.txt | 1 + .../ecosystem/teamcity/agent/php8.0/Makefile | 6 +- .../teamcity/agent/php8.0/kaniko-build.py | 196 ------------------ .../teamcity/agent/php8.0/requirements.txt | 1 + .../ecosystem/teamcity/agent/php8.1/Makefile | 6 +- .../teamcity/agent/php8.1/kaniko-build.py | 196 ------------------ .../teamcity/agent/php8.1/requirements.txt | 1 + .../ecosystem/teamcity/agent/php8.2/Makefile | 6 +- .../teamcity/agent/php8.2/kaniko-build.py | 196 ------------------ .../teamcity/agent/php8.2/requirements.txt | 1 + .../ecosystem/teamcity/agent/php8.3/Makefile | 6 +- .../teamcity/agent/php8.3/kaniko-build.py | 196 ------------------ .../teamcity/agent/php8.3/requirements.txt | 1 + .../teamcity/agent/steam-sdk/Makefile | 6 +- .../teamcity/agent/steam-sdk/kaniko-build.py | 196 ------------------ .../teamcity/agent/steam-sdk/requirements.txt | 1 + .../ecosystem/testrail/5.4.1.3669/ad/Makefile | 6 +- .../testrail/5.4.1.3669/ad/kaniko-build.py | 196 ------------------ .../testrail/5.4.1.3669/ad/requirements.txt | 1 + .../testrail/5.4.1.3669/ldap/Makefile | 6 +- .../testrail/5.4.1.3669/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.4.1.3669/ldap/requirements.txt | 1 + .../testrail/5.4.1.3669/main/Makefile | 6 +- .../testrail/5.4.1.3669/main/kaniko-build.py | 196 ------------------ .../testrail/5.4.1.3669/main/requirements.txt | 1 + .../ecosystem/testrail/5.5.0.3727/ad/Makefile | 6 +- .../testrail/5.5.0.3727/ad/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3727/ad/requirements.txt | 1 + .../testrail/5.5.0.3727/ldap/Makefile | 6 +- .../testrail/5.5.0.3727/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3727/ldap/requirements.txt | 1 + .../testrail/5.5.0.3727/main/Makefile | 6 +- .../testrail/5.5.0.3727/main/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3727/main/requirements.txt | 1 + .../ecosystem/testrail/5.5.0.3731/ad/Makefile | 6 +- .../testrail/5.5.0.3731/ad/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3731/ad/requirements.txt | 1 + .../testrail/5.5.0.3731/ldap/Makefile | 6 +- .../testrail/5.5.0.3731/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3731/ldap/requirements.txt | 1 + .../testrail/5.5.0.3731/main/Makefile | 6 +- .../testrail/5.5.0.3731/main/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3731/main/requirements.txt | 1 + .../ecosystem/testrail/5.5.0.3735/ad/Makefile | 6 +- .../testrail/5.5.0.3735/ad/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3735/ad/requirements.txt | 1 + .../testrail/5.5.0.3735/ldap/Makefile | 6 +- .../testrail/5.5.0.3735/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3735/ldap/requirements.txt | 1 + .../testrail/5.5.0.3735/main/Makefile | 6 +- .../testrail/5.5.0.3735/main/kaniko-build.py | 196 ------------------ .../testrail/5.5.0.3735/main/requirements.txt | 1 + .../ecosystem/testrail/5.5.1.3746/ad/Makefile | 6 +- .../testrail/5.5.1.3746/ad/kaniko-build.py | 196 ------------------ .../testrail/5.5.1.3746/ad/requirements.txt | 1 + .../testrail/5.5.1.3746/ldap/Makefile | 6 +- .../testrail/5.5.1.3746/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.5.1.3746/ldap/requirements.txt | 1 + .../testrail/5.5.1.3746/main/Makefile | 6 +- .../testrail/5.5.1.3746/main/kaniko-build.py | 196 ------------------ .../testrail/5.5.1.3746/main/requirements.txt | 1 + .../ecosystem/testrail/5.6.0.3853/ad/Makefile | 6 +- .../testrail/5.6.0.3853/ad/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3853/ad/requirements.txt | 1 + .../testrail/5.6.0.3853/ldap/Makefile | 6 +- .../testrail/5.6.0.3853/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3853/ldap/requirements.txt | 1 + .../testrail/5.6.0.3853/main/Makefile | 6 +- .../testrail/5.6.0.3853/main/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3853/main/requirements.txt | 1 + .../ecosystem/testrail/5.6.0.3856/ad/Makefile | 6 +- .../testrail/5.6.0.3856/ad/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3856/ad/requirements.txt | 1 + .../testrail/5.6.0.3856/ldap/Makefile | 6 +- .../testrail/5.6.0.3856/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3856/ldap/requirements.txt | 1 + .../testrail/5.6.0.3856/main/Makefile | 6 +- .../testrail/5.6.0.3856/main/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3856/main/requirements.txt | 1 + .../ecosystem/testrail/5.6.0.3861/ad/Makefile | 6 +- .../testrail/5.6.0.3861/ad/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3861/ad/requirements.txt | 1 + .../testrail/5.6.0.3861/ldap/Makefile | 6 +- .../testrail/5.6.0.3861/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3861/ldap/requirements.txt | 1 + .../testrail/5.6.0.3861/main/Makefile | 6 +- .../testrail/5.6.0.3861/main/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3861/main/requirements.txt | 1 + .../ecosystem/testrail/5.6.0.3862/ad/Makefile | 6 +- .../testrail/5.6.0.3862/ad/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3862/ad/requirements.txt | 1 + .../testrail/5.6.0.3862/ldap/Makefile | 6 +- .../testrail/5.6.0.3862/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3862/ldap/requirements.txt | 1 + .../testrail/5.6.0.3862/main/Makefile | 6 +- .../testrail/5.6.0.3862/main/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3862/main/requirements.txt | 1 + .../ecosystem/testrail/5.6.0.3865/ad/Makefile | 6 +- .../testrail/5.6.0.3865/ad/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3865/ad/requirements.txt | 1 + .../testrail/5.6.0.3865/ldap/Makefile | 6 +- .../testrail/5.6.0.3865/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3865/ldap/requirements.txt | 1 + .../testrail/5.6.0.3865/main/Makefile | 6 +- .../testrail/5.6.0.3865/main/kaniko-build.py | 196 ------------------ .../testrail/5.6.0.3865/main/requirements.txt | 1 + .../ecosystem/testrail/5.7.0.3938/ad/Makefile | 6 +- .../testrail/5.7.0.3938/ad/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3938/ad/requirements.txt | 1 + .../testrail/5.7.0.3938/ldap/Makefile | 6 +- .../testrail/5.7.0.3938/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3938/ldap/requirements.txt | 1 + .../testrail/5.7.0.3938/main/Makefile | 6 +- .../testrail/5.7.0.3938/main/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3938/main/requirements.txt | 1 + .../ecosystem/testrail/5.7.0.3942/ad/Makefile | 6 +- .../testrail/5.7.0.3942/ad/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3942/ad/requirements.txt | 1 + .../testrail/5.7.0.3942/ldap/Makefile | 6 +- .../testrail/5.7.0.3942/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3942/ldap/requirements.txt | 1 + .../testrail/5.7.0.3942/main/Makefile | 6 +- .../testrail/5.7.0.3942/main/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3942/main/requirements.txt | 1 + .../ecosystem/testrail/5.7.0.3951/ad/Makefile | 6 +- .../testrail/5.7.0.3951/ad/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3951/ad/requirements.txt | 1 + .../testrail/5.7.0.3951/ldap/Makefile | 6 +- .../testrail/5.7.0.3951/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3951/ldap/requirements.txt | 1 + .../testrail/5.7.0.3951/main/Makefile | 6 +- .../testrail/5.7.0.3951/main/kaniko-build.py | 196 ------------------ .../testrail/5.7.0.3951/main/requirements.txt | 1 + .../ecosystem/testrail/5.7.1.4026/ad/Makefile | 6 +- .../testrail/5.7.1.4026/ad/kaniko-build.py | 196 ------------------ .../testrail/5.7.1.4026/ad/requirements.txt | 1 + .../testrail/5.7.1.4026/ldap/Makefile | 6 +- .../testrail/5.7.1.4026/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.7.1.4026/ldap/requirements.txt | 1 + .../testrail/5.7.1.4026/main/Makefile | 6 +- .../testrail/5.7.1.4026/main/kaniko-build.py | 196 ------------------ .../testrail/5.7.1.4026/main/requirements.txt | 1 + .../ecosystem/testrail/5.7.1.4028/ad/Makefile | 6 +- .../testrail/5.7.1.4028/ad/kaniko-build.py | 196 ------------------ .../testrail/5.7.1.4028/ad/requirements.txt | 1 + .../testrail/5.7.1.4028/ldap/Makefile | 6 +- .../testrail/5.7.1.4028/ldap/kaniko-build.py | 196 ------------------ .../testrail/5.7.1.4028/ldap/requirements.txt | 1 + .../testrail/5.7.1.4028/main/Makefile | 6 +- .../testrail/5.7.1.4028/main/kaniko-build.py | 196 ------------------ .../testrail/5.7.1.4028/main/requirements.txt | 1 + .../ecosystem/testrail/6.0.0.4140/ad/Makefile | 6 +- .../testrail/6.0.0.4140/ad/kaniko-build.py | 196 ------------------ .../testrail/6.0.0.4140/ad/requirements.txt | 1 + .../testrail/6.0.0.4140/ldap/Makefile | 6 +- .../testrail/6.0.0.4140/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.0.0.4140/ldap/requirements.txt | 1 + .../testrail/6.0.0.4140/main/Makefile | 6 +- .../testrail/6.0.0.4140/main/kaniko-build.py | 196 ------------------ .../testrail/6.0.0.4140/main/requirements.txt | 1 + .../ecosystem/testrail/6.0.1.4163/ad/Makefile | 6 +- .../testrail/6.0.1.4163/ad/kaniko-build.py | 196 ------------------ .../testrail/6.0.1.4163/ad/requirements.txt | 1 + .../testrail/6.0.1.4163/ldap/Makefile | 6 +- .../testrail/6.0.1.4163/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.0.1.4163/ldap/requirements.txt | 1 + .../testrail/6.0.1.4163/main/Makefile | 6 +- .../testrail/6.0.1.4163/main/kaniko-build.py | 196 ------------------ .../testrail/6.0.1.4163/main/requirements.txt | 1 + .../ecosystem/testrail/6.1.0.4367/ad/Makefile | 6 +- .../testrail/6.1.0.4367/ad/kaniko-build.py | 196 ------------------ .../testrail/6.1.0.4367/ad/requirements.txt | 1 + .../testrail/6.1.0.4367/ldap/Makefile | 6 +- .../testrail/6.1.0.4367/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.1.0.4367/ldap/requirements.txt | 1 + .../testrail/6.1.0.4367/main/Makefile | 6 +- .../testrail/6.1.0.4367/main/kaniko-build.py | 196 ------------------ .../testrail/6.1.0.4367/main/requirements.txt | 1 + .../ecosystem/testrail/6.1.0.4369/ad/Makefile | 6 +- .../testrail/6.1.0.4369/ad/kaniko-build.py | 196 ------------------ .../testrail/6.1.0.4369/ad/requirements.txt | 1 + .../testrail/6.1.0.4369/ldap/Makefile | 6 +- .../testrail/6.1.0.4369/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.1.0.4369/ldap/requirements.txt | 1 + .../testrail/6.1.0.4369/main/Makefile | 6 +- .../testrail/6.1.0.4369/main/kaniko-build.py | 196 ------------------ .../testrail/6.1.0.4369/main/requirements.txt | 1 + .../ecosystem/testrail/6.1.1.1020/ad/Makefile | 6 +- .../testrail/6.1.1.1020/ad/kaniko-build.py | 196 ------------------ .../testrail/6.1.1.1020/ad/requirements.txt | 1 + .../testrail/6.1.1.1020/ldap/Makefile | 6 +- .../testrail/6.1.1.1020/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.1.1.1020/ldap/requirements.txt | 1 + .../testrail/6.1.1.1020/main/Makefile | 6 +- .../testrail/6.1.1.1020/main/kaniko-build.py | 196 ------------------ .../testrail/6.1.1.1020/main/requirements.txt | 1 + .../ecosystem/testrail/6.1.1.1021/ad/Makefile | 6 +- .../testrail/6.1.1.1021/ad/kaniko-build.py | 196 ------------------ .../testrail/6.1.1.1021/ad/requirements.txt | 1 + .../testrail/6.1.1.1021/ldap/Makefile | 6 +- .../testrail/6.1.1.1021/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.1.1.1021/ldap/requirements.txt | 1 + .../testrail/6.1.1.1021/main/Makefile | 6 +- .../testrail/6.1.1.1021/main/kaniko-build.py | 196 ------------------ .../testrail/6.1.1.1021/main/requirements.txt | 1 + .../ecosystem/testrail/6.2.0.1085/ad/Makefile | 6 +- .../testrail/6.2.0.1085/ad/kaniko-build.py | 196 ------------------ .../testrail/6.2.0.1085/ad/requirements.txt | 1 + .../testrail/6.2.0.1085/ldap/Makefile | 6 +- .../testrail/6.2.0.1085/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.2.0.1085/ldap/requirements.txt | 1 + .../testrail/6.2.0.1085/main/Makefile | 6 +- .../testrail/6.2.0.1085/main/kaniko-build.py | 196 ------------------ .../testrail/6.2.0.1085/main/requirements.txt | 1 + .../ecosystem/testrail/6.2.1.1003/ad/Makefile | 6 +- .../testrail/6.2.1.1003/ad/kaniko-build.py | 196 ------------------ .../testrail/6.2.1.1003/ad/requirements.txt | 1 + .../testrail/6.2.1.1003/ldap/Makefile | 6 +- .../testrail/6.2.1.1003/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.2.1.1003/ldap/requirements.txt | 1 + .../testrail/6.2.1.1003/main/Makefile | 6 +- .../testrail/6.2.1.1003/main/kaniko-build.py | 196 ------------------ .../testrail/6.2.1.1003/main/requirements.txt | 1 + .../ecosystem/testrail/6.2.1.1005/ad/Makefile | 6 +- .../testrail/6.2.1.1005/ad/kaniko-build.py | 196 ------------------ .../testrail/6.2.1.1005/ad/requirements.txt | 1 + .../testrail/6.2.1.1005/ldap/Makefile | 6 +- .../testrail/6.2.1.1005/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.2.1.1005/ldap/requirements.txt | 1 + .../testrail/6.2.1.1005/main/Makefile | 6 +- .../testrail/6.2.1.1005/main/kaniko-build.py | 196 ------------------ .../testrail/6.2.1.1005/main/requirements.txt | 1 + .../ecosystem/testrail/6.2.2.1107/ad/Makefile | 6 +- .../testrail/6.2.2.1107/ad/kaniko-build.py | 196 ------------------ .../testrail/6.2.2.1107/ad/requirements.txt | 1 + .../testrail/6.2.2.1107/ldap/Makefile | 6 +- .../testrail/6.2.2.1107/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.2.2.1107/ldap/requirements.txt | 1 + .../testrail/6.2.2.1107/main/Makefile | 6 +- .../testrail/6.2.2.1107/main/kaniko-build.py | 196 ------------------ .../testrail/6.2.2.1107/main/requirements.txt | 1 + .../ecosystem/testrail/6.2.3.1114/ad/Makefile | 6 +- .../testrail/6.2.3.1114/ad/kaniko-build.py | 196 ------------------ .../testrail/6.2.3.1114/ad/requirements.txt | 1 + .../testrail/6.2.3.1114/ldap/Makefile | 6 +- .../testrail/6.2.3.1114/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.2.3.1114/ldap/requirements.txt | 1 + .../testrail/6.2.3.1114/main/Makefile | 6 +- .../testrail/6.2.3.1114/main/kaniko-build.py | 196 ------------------ .../testrail/6.2.3.1114/main/requirements.txt | 1 + .../ecosystem/testrail/6.3.0.1120/ad/Makefile | 6 +- .../testrail/6.3.0.1120/ad/kaniko-build.py | 196 ------------------ .../testrail/6.3.0.1120/ad/requirements.txt | 1 + .../testrail/6.3.0.1120/ldap/Makefile | 6 +- .../testrail/6.3.0.1120/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.3.0.1120/ldap/requirements.txt | 1 + .../testrail/6.3.0.1120/main/Makefile | 6 +- .../testrail/6.3.0.1120/main/kaniko-build.py | 196 ------------------ .../testrail/6.3.0.1120/main/requirements.txt | 1 + .../ecosystem/testrail/6.3.1.1004/ad/Makefile | 6 +- .../testrail/6.3.1.1004/ad/kaniko-build.py | 196 ------------------ .../testrail/6.3.1.1004/ad/requirements.txt | 1 + .../testrail/6.3.1.1004/ldap/Makefile | 6 +- .../testrail/6.3.1.1004/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.3.1.1004/ldap/requirements.txt | 1 + .../testrail/6.3.1.1004/main/Makefile | 6 +- .../testrail/6.3.1.1004/main/kaniko-build.py | 196 ------------------ .../testrail/6.3.1.1004/main/requirements.txt | 1 + .../ecosystem/testrail/6.3.1.1006/ad/Makefile | 6 +- .../testrail/6.3.1.1006/ad/kaniko-build.py | 196 ------------------ .../testrail/6.3.1.1006/ad/requirements.txt | 1 + .../testrail/6.3.1.1006/ldap/Makefile | 6 +- .../testrail/6.3.1.1006/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.3.1.1006/ldap/requirements.txt | 1 + .../testrail/6.3.1.1006/main/Makefile | 6 +- .../testrail/6.3.1.1006/main/kaniko-build.py | 196 ------------------ .../testrail/6.3.1.1006/main/requirements.txt | 1 + .../ecosystem/testrail/6.4.0.1284/ad/Makefile | 6 +- .../testrail/6.4.0.1284/ad/kaniko-build.py | 196 ------------------ .../testrail/6.4.0.1284/ad/requirements.txt | 1 + .../testrail/6.4.0.1284/ldap/Makefile | 6 +- .../testrail/6.4.0.1284/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.4.0.1284/ldap/requirements.txt | 1 + .../testrail/6.4.0.1284/main/Makefile | 6 +- .../testrail/6.4.0.1284/main/kaniko-build.py | 196 ------------------ .../testrail/6.4.0.1284/main/requirements.txt | 1 + .../ecosystem/testrail/6.4.0.1293/ad/Makefile | 6 +- .../testrail/6.4.0.1293/ad/kaniko-build.py | 196 ------------------ .../testrail/6.4.0.1293/ad/requirements.txt | 1 + .../testrail/6.4.0.1293/ldap/Makefile | 6 +- .../testrail/6.4.0.1293/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.4.0.1293/ldap/requirements.txt | 1 + .../testrail/6.4.0.1293/main/Makefile | 6 +- .../testrail/6.4.0.1293/main/kaniko-build.py | 196 ------------------ .../testrail/6.4.0.1293/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.0.1298/ad/Makefile | 6 +- .../testrail/6.5.0.1298/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.0.1298/ad/requirements.txt | 1 + .../testrail/6.5.0.1298/ldap/Makefile | 6 +- .../testrail/6.5.0.1298/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.0.1298/ldap/requirements.txt | 1 + .../testrail/6.5.0.1298/main/Makefile | 6 +- .../testrail/6.5.0.1298/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.0.1298/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.1.1002/ad/Makefile | 6 +- .../testrail/6.5.1.1002/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.1.1002/ad/requirements.txt | 1 + .../testrail/6.5.1.1002/ldap/Makefile | 6 +- .../testrail/6.5.1.1002/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.1.1002/ldap/requirements.txt | 1 + .../testrail/6.5.1.1002/main/Makefile | 6 +- .../testrail/6.5.1.1002/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.1.1002/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.3.1001/ad/Makefile | 6 +- .../testrail/6.5.3.1001/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.3.1001/ad/requirements.txt | 1 + .../testrail/6.5.3.1001/ldap/Makefile | 6 +- .../testrail/6.5.3.1001/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.3.1001/ldap/requirements.txt | 1 + .../testrail/6.5.3.1001/main/Makefile | 6 +- .../testrail/6.5.3.1001/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.3.1001/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.4.1002/ad/Makefile | 6 +- .../testrail/6.5.4.1002/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.4.1002/ad/requirements.txt | 1 + .../testrail/6.5.4.1002/ldap/Makefile | 6 +- .../testrail/6.5.4.1002/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.4.1002/ldap/requirements.txt | 1 + .../testrail/6.5.4.1002/main/Makefile | 6 +- .../testrail/6.5.4.1002/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.4.1002/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.4.1007/ad/Makefile | 6 +- .../testrail/6.5.4.1007/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.4.1007/ad/requirements.txt | 1 + .../testrail/6.5.4.1007/ldap/Makefile | 6 +- .../testrail/6.5.4.1007/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.4.1007/ldap/requirements.txt | 1 + .../testrail/6.5.4.1007/main/Makefile | 6 +- .../testrail/6.5.4.1007/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.4.1007/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.5.1009/ad/Makefile | 6 +- .../testrail/6.5.5.1009/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.5.1009/ad/requirements.txt | 1 + .../testrail/6.5.5.1009/ldap/Makefile | 6 +- .../testrail/6.5.5.1009/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.5.1009/ldap/requirements.txt | 1 + .../testrail/6.5.5.1009/main/Makefile | 6 +- .../testrail/6.5.5.1009/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.5.1009/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.6.1014/ad/Makefile | 6 +- .../testrail/6.5.6.1014/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.6.1014/ad/requirements.txt | 1 + .../testrail/6.5.6.1014/ldap/Makefile | 6 +- .../testrail/6.5.6.1014/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.6.1014/ldap/requirements.txt | 1 + .../testrail/6.5.6.1014/main/Makefile | 6 +- .../testrail/6.5.6.1014/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.6.1014/main/requirements.txt | 1 + .../ecosystem/testrail/6.5.7.1000/ad/Makefile | 6 +- .../testrail/6.5.7.1000/ad/kaniko-build.py | 196 ------------------ .../testrail/6.5.7.1000/ad/requirements.txt | 1 + .../testrail/6.5.7.1000/ldap/Makefile | 6 +- .../testrail/6.5.7.1000/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.5.7.1000/ldap/requirements.txt | 1 + .../testrail/6.5.7.1000/main/Makefile | 6 +- .../testrail/6.5.7.1000/main/kaniko-build.py | 196 ------------------ .../testrail/6.5.7.1000/main/requirements.txt | 1 + .../ecosystem/testrail/6.6.0.1156/ad/Makefile | 6 +- .../testrail/6.6.0.1156/ad/kaniko-build.py | 196 ------------------ .../testrail/6.6.0.1156/ad/requirements.txt | 1 + .../testrail/6.6.0.1156/ldap/Makefile | 6 +- .../testrail/6.6.0.1156/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.6.0.1156/ldap/requirements.txt | 1 + .../testrail/6.6.0.1156/main/Makefile | 6 +- .../testrail/6.6.0.1156/main/kaniko-build.py | 196 ------------------ .../testrail/6.6.0.1156/main/requirements.txt | 1 + .../ecosystem/testrail/6.6.1.1166/ad/Makefile | 6 +- .../testrail/6.6.1.1166/ad/kaniko-build.py | 196 ------------------ .../testrail/6.6.1.1166/ad/requirements.txt | 1 + .../testrail/6.6.1.1166/ldap/Makefile | 6 +- .../testrail/6.6.1.1166/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.6.1.1166/ldap/requirements.txt | 1 + .../testrail/6.6.1.1166/main/Makefile | 6 +- .../testrail/6.6.1.1166/main/kaniko-build.py | 196 ------------------ .../testrail/6.6.1.1166/main/requirements.txt | 1 + .../ecosystem/testrail/6.7.1.1020/ad/Makefile | 6 +- .../testrail/6.7.1.1020/ad/kaniko-build.py | 196 ------------------ .../testrail/6.7.1.1020/ad/requirements.txt | 1 + .../testrail/6.7.1.1020/ldap/Makefile | 6 +- .../testrail/6.7.1.1020/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.7.1.1020/ldap/requirements.txt | 1 + .../testrail/6.7.1.1020/main/Makefile | 6 +- .../testrail/6.7.1.1020/main/kaniko-build.py | 196 ------------------ .../testrail/6.7.1.1020/main/requirements.txt | 1 + .../ecosystem/testrail/6.7.2.1037/ad/Makefile | 6 +- .../testrail/6.7.2.1037/ad/kaniko-build.py | 196 ------------------ .../testrail/6.7.2.1037/ad/requirements.txt | 1 + .../testrail/6.7.2.1037/ldap/Makefile | 6 +- .../testrail/6.7.2.1037/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.7.2.1037/ldap/requirements.txt | 1 + .../testrail/6.7.2.1037/main/Makefile | 6 +- .../testrail/6.7.2.1037/main/kaniko-build.py | 196 ------------------ .../testrail/6.7.2.1037/main/requirements.txt | 1 + .../ecosystem/testrail/6.7.2.1043/ad/Makefile | 6 +- .../testrail/6.7.2.1043/ad/kaniko-build.py | 196 ------------------ .../testrail/6.7.2.1043/ad/requirements.txt | 1 + .../testrail/6.7.2.1043/ldap/Makefile | 6 +- .../testrail/6.7.2.1043/ldap/kaniko-build.py | 196 ------------------ .../testrail/6.7.2.1043/ldap/requirements.txt | 1 + .../testrail/6.7.2.1043/main/Makefile | 6 +- .../testrail/6.7.2.1043/main/kaniko-build.py | 196 ------------------ .../testrail/6.7.2.1043/main/requirements.txt | 1 + .../ecosystem/testrail/7.0.0.1057/ad/Makefile | 6 +- .../testrail/7.0.0.1057/ad/kaniko-build.py | 196 ------------------ .../testrail/7.0.0.1057/ad/requirements.txt | 1 + .../testrail/7.0.0.1057/ldap/Makefile | 6 +- .../testrail/7.0.0.1057/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.0.0.1057/ldap/requirements.txt | 1 + .../testrail/7.0.0.1057/main/Makefile | 6 +- .../testrail/7.0.0.1057/main/kaniko-build.py | 196 ------------------ .../testrail/7.0.0.1057/main/requirements.txt | 1 + .../ecosystem/testrail/7.0.1.1002/ad/Makefile | 6 +- .../testrail/7.0.1.1002/ad/kaniko-build.py | 196 ------------------ .../testrail/7.0.1.1002/ad/requirements.txt | 1 + .../testrail/7.0.1.1002/ldap/Makefile | 6 +- .../testrail/7.0.1.1002/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.0.1.1002/ldap/requirements.txt | 1 + .../testrail/7.0.1.1002/main/Makefile | 6 +- .../testrail/7.0.1.1002/main/kaniko-build.py | 196 ------------------ .../testrail/7.0.1.1002/main/requirements.txt | 1 + .../ecosystem/testrail/7.0.1.1013/ad/Makefile | 6 +- .../testrail/7.0.1.1013/ad/kaniko-build.py | 196 ------------------ .../testrail/7.0.1.1013/ad/requirements.txt | 1 + .../testrail/7.0.1.1013/ldap/Makefile | 6 +- .../testrail/7.0.1.1013/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.0.1.1013/ldap/requirements.txt | 1 + .../testrail/7.0.1.1013/main/Makefile | 6 +- .../testrail/7.0.1.1013/main/kaniko-build.py | 196 ------------------ .../testrail/7.0.1.1013/main/requirements.txt | 1 + .../ecosystem/testrail/7.0.2.1014/ad/Makefile | 6 +- .../testrail/7.0.2.1014/ad/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1014/ad/requirements.txt | 1 + .../testrail/7.0.2.1014/ldap/Makefile | 6 +- .../testrail/7.0.2.1014/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1014/ldap/requirements.txt | 1 + .../testrail/7.0.2.1014/main/Makefile | 6 +- .../testrail/7.0.2.1014/main/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1014/main/requirements.txt | 1 + .../ecosystem/testrail/7.0.2.1015/ad/Makefile | 6 +- .../testrail/7.0.2.1015/ad/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1015/ad/requirements.txt | 1 + .../testrail/7.0.2.1015/ldap/Makefile | 6 +- .../testrail/7.0.2.1015/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1015/ldap/requirements.txt | 1 + .../testrail/7.0.2.1015/main/Makefile | 6 +- .../testrail/7.0.2.1015/main/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1015/main/requirements.txt | 1 + .../ecosystem/testrail/7.0.2.1016/ad/Makefile | 6 +- .../testrail/7.0.2.1016/ad/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1016/ad/requirements.txt | 1 + .../testrail/7.0.2.1016/ldap/Makefile | 6 +- .../testrail/7.0.2.1016/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1016/ldap/requirements.txt | 1 + .../testrail/7.0.2.1016/main/Makefile | 6 +- .../testrail/7.0.2.1016/main/kaniko-build.py | 196 ------------------ .../testrail/7.0.2.1016/main/requirements.txt | 1 + .../ecosystem/testrail/7.4.1.8079/ad/Makefile | 6 +- .../testrail/7.4.1.8079/ad/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8079/ad/requirements.txt | 1 + .../testrail/7.4.1.8079/ldap/Makefile | 6 +- .../testrail/7.4.1.8079/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8079/ldap/requirements.txt | 1 + .../testrail/7.4.1.8079/main/Makefile | 6 +- .../testrail/7.4.1.8079/main/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8079/main/requirements.txt | 1 + .../ecosystem/testrail/7.4.1.8091/ad/Makefile | 6 +- .../testrail/7.4.1.8091/ad/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8091/ad/requirements.txt | 1 + .../testrail/7.4.1.8091/ldap/Makefile | 6 +- .../testrail/7.4.1.8091/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8091/ldap/requirements.txt | 1 + .../testrail/7.4.1.8091/main/Makefile | 6 +- .../testrail/7.4.1.8091/main/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8091/main/requirements.txt | 1 + .../ecosystem/testrail/7.4.1.8092/ad/Makefile | 6 +- .../testrail/7.4.1.8092/ad/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8092/ad/requirements.txt | 1 + .../testrail/7.4.1.8092/ldap/Makefile | 6 +- .../testrail/7.4.1.8092/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8092/ldap/requirements.txt | 1 + .../testrail/7.4.1.8092/main/Makefile | 6 +- .../testrail/7.4.1.8092/main/kaniko-build.py | 196 ------------------ .../testrail/7.4.1.8092/main/requirements.txt | 1 + .../ecosystem/testrail/7.5.1.7010/ad/Makefile | 6 +- .../testrail/7.5.1.7010/ad/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7010/ad/requirements.txt | 1 + .../testrail/7.5.1.7010/ldap/Makefile | 6 +- .../testrail/7.5.1.7010/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7010/ldap/requirements.txt | 1 + .../testrail/7.5.1.7010/main/Makefile | 6 +- .../testrail/7.5.1.7010/main/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7010/main/requirements.txt | 1 + .../ecosystem/testrail/7.5.1.7012/ad/Makefile | 6 +- .../testrail/7.5.1.7012/ad/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7012/ad/requirements.txt | 1 + .../testrail/7.5.1.7012/ldap/Makefile | 6 +- .../testrail/7.5.1.7012/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7012/ldap/requirements.txt | 1 + .../testrail/7.5.1.7012/main/Makefile | 6 +- .../testrail/7.5.1.7012/main/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7012/main/requirements.txt | 1 + .../ecosystem/testrail/7.5.1.7013/ad/Makefile | 6 +- .../testrail/7.5.1.7013/ad/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7013/ad/requirements.txt | 1 + .../testrail/7.5.1.7013/ldap/Makefile | 6 +- .../testrail/7.5.1.7013/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7013/ldap/requirements.txt | 1 + .../testrail/7.5.1.7013/main/Makefile | 6 +- .../testrail/7.5.1.7013/main/kaniko-build.py | 196 ------------------ .../testrail/7.5.1.7013/main/requirements.txt | 1 + .../ecosystem/testrail/7.5.2.1002/ad/Makefile | 6 +- .../testrail/7.5.2.1002/ad/kaniko-build.py | 196 ------------------ .../testrail/7.5.2.1002/ad/requirements.txt | 1 + .../testrail/7.5.2.1002/ldap/Makefile | 6 +- .../testrail/7.5.2.1002/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.5.2.1002/ldap/requirements.txt | 1 + .../testrail/7.5.2.1002/main/Makefile | 6 +- .../testrail/7.5.2.1002/main/kaniko-build.py | 196 ------------------ .../testrail/7.5.2.1002/main/requirements.txt | 1 + .../ecosystem/testrail/7.5.3.1000/ad/Makefile | 6 +- .../testrail/7.5.3.1000/ad/kaniko-build.py | 196 ------------------ .../testrail/7.5.3.1000/ad/requirements.txt | 1 + .../testrail/7.5.3.1000/ldap/Makefile | 6 +- .../testrail/7.5.3.1000/ldap/kaniko-build.py | 196 ------------------ .../testrail/7.5.3.1000/ldap/requirements.txt | 1 + .../testrail/7.5.3.1000/main/Makefile | 6 +- .../testrail/7.5.3.1000/main/kaniko-build.py | 196 ------------------ .../testrail/7.5.3.1000/main/requirements.txt | 1 + .../ecosystem/testrail/8.0.0.1089/ad/Makefile | 6 +- .../testrail/8.0.0.1089/ad/kaniko-build.py | 196 ------------------ .../testrail/8.0.0.1089/ad/requirements.txt | 1 + .../testrail/8.0.0.1089/ldap/Makefile | 6 +- .../testrail/8.0.0.1089/ldap/kaniko-build.py | 196 ------------------ .../testrail/8.0.0.1089/ldap/requirements.txt | 1 + .../testrail/8.0.0.1089/main/Makefile | 6 +- .../testrail/8.0.0.1089/main/kaniko-build.py | 196 ------------------ .../testrail/8.0.0.1089/main/requirements.txt | 1 + .../ecosystem/testrail/8.0.1.1029/ad/Makefile | 6 +- .../testrail/8.0.1.1029/ad/kaniko-build.py | 196 ------------------ .../testrail/8.0.1.1029/ad/requirements.txt | 1 + .../testrail/8.0.1.1029/ldap/Makefile | 6 +- .../testrail/8.0.1.1029/ldap/kaniko-build.py | 196 ------------------ .../testrail/8.0.1.1029/ldap/requirements.txt | 1 + .../testrail/8.0.1.1029/main/Makefile | 6 +- .../testrail/8.0.1.1029/main/kaniko-build.py | 196 ------------------ .../testrail/8.0.1.1029/main/requirements.txt | 1 + linux/ecosystem/torrserver/Makefile | 6 +- linux/ecosystem/torrserver/kaniko-build.py | 196 ------------------ linux/ecosystem/torrserver/requirements.txt | 1 + linux/ecosystem/torrust-index/Makefile | 6 +- linux/ecosystem/torrust-index/kaniko-build.py | 196 ------------------ .../ecosystem/torrust-index/requirements.txt | 1 + linux/ecosystem/torrust-tracker/Makefile | 6 +- .../ecosystem/torrust-tracker/kaniko-build.py | 196 ------------------ .../torrust-tracker/requirements.txt | 1 + linux/ecosystem/vk2discord/Makefile | 6 +- linux/ecosystem/vk2discord/kaniko-build.py | 196 ------------------ linux/ecosystem/vk2discord/requirements.txt | 1 + 4696 files changed, 5662 insertions(+), 334215 deletions(-) delete mode 100644 bin/ansible/roles/atlassian.bitbucket/files/kaniko-build.py delete mode 100644 bin/ansible/roles/atlassian.jira/files/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php70/ad/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php70/ldap/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php70/main/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php71/ad/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php71/ldap/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php71/main/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php72/ad/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php72/ldap/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php72/main/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php74/ad/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php74/ldap/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php74/main/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php81/ad/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php81/ldap/kaniko-build.py delete mode 100644 bin/ansible/roles/gurock.testrail/files/php81/main/kaniko-build.py delete mode 100644 bin/kaniko/kaniko-build.py delete mode 100644 linux/advanced/mattermost/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/14/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/15/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/16/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/17/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/18/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/19/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/20/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/21/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/22/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/23/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/24/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/25/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/26/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/27/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/28/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/29/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/patched/latest/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/14/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/15/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/16/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/17/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/18/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/19/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/20/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/21/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/22/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/23/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/24/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/25/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/26/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/27/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/28/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/29/kaniko-build.py delete mode 100644 linux/advanced/nextcloud/pure/latest/kaniko-build.py delete mode 100644 linux/advanced/python/develop/2.7/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.10/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.11/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.12/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.13/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.6/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.7/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.8/kaniko-build.py delete mode 100644 linux/advanced/python/develop/3.9/kaniko-build.py delete mode 100644 linux/advanced/python/main/2.7/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.10/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.11/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.12/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.13/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.6/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.7/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.8/kaniko-build.py delete mode 100644 linux/advanced/python/main/3.9/kaniko-build.py delete mode 100644 linux/advanced/sentry/latest/kaniko-build.py delete mode 100644 linux/advanced/teamcity/server/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/amxx/1.10/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/amxx/1.9/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/android/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/cpp/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/devops/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/docker/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/dotnet-full/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/dotnet/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/latest/kaniko-build.py delete mode 100644 linux/advanced/vscode-server/mono/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/3.0/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/4.0/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.0/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.2/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/5.4/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.0/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.2/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/6.4/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/latest/web-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/agent/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/agent2/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/java-gateway/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/proxy-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/proxy-sqlite3/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/server-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/server-pgsql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/snmptraps/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/web-mysql/kaniko-build.py delete mode 100644 linux/advanced/zabbix/trunk/web-pgsql/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/devel/jdk11/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/devel/jdk16/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/devel/jdk6/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/devel/jdk7/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/devel/jdk8/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/devel/main/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/edge/jdk11/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/edge/jdk16/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/edge/jdk6/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/edge/jdk7/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/edge/jdk8/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/edge/main/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/prod/jdk11/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/prod/jdk16/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/prod/jdk6/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/prod/jdk7/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/prod/jdk8/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/epicmorg/prod/main/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.0/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.1/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.2/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.3.1/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.3.2/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.3/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/1.4/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/freegpt-webui/latest/kaniko-build.py delete mode 100644 linux/discontinued/ecosystem/syspass/sysPass/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php5.5/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php7.0/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php7.1/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php7.2/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php7.3/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php7.4/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php8.0/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php8.1/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php8.2/kaniko-build.py delete mode 100644 linux/ecosystem/apache2/php8.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/1/1.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/1/1.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/1/1.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/1/1.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/1/1.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.10.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.10.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.10.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.11.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.12.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.6.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.7.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.8.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.8.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.9.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.9.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.9.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/2/2.9.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.0.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.0.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.0.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.0.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.1.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.1.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.10.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.10.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.11.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.11.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.11.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.11.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.11.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.11.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.2.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.2.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.3.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.7.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.7.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/3/3.9.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.0.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.1.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.11.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.11.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.12.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.13.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.13.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.14.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.8.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/4/4.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/7/7.21.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.17.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.19.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/8/8.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/9/9.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/bitbucket/latest/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.0.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.10.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.11.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.11.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.11.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.12.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.12.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.12.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.12.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.18/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.19/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.20/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.21/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.13.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.14.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.14.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.14.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.14.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.15.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.6.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.7.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.8.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.8.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.8.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/6/6.9.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.18/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.19.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.20.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.20.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.20.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/7/7.20.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/8/8.9.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/9/9.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/9/9.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/latest/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/templates/5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/confluence/templates/6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crowd/5/5.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crowd/latest/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.5.a/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.5a/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/1/1.6.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/crucible/templates/1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/latest/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/templates/2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/templates/3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye-crucible/templates/4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.0.1a/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.2.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.3.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.3.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.3.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.3.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.5.a/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.5a/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/1/1.6.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/fisheye/templates/1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/4/4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/5/5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/6/6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.0.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.0-m01/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.1.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.11.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.11.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.11.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.12.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.12.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.18/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.13.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.2.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.3.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.4.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.6.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.7.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.8.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.8.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/7/7.9.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.0.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.0.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.1.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.1.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.11.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.11.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.12.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.12.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.12.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.18/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.19/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.20/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.21/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.22/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.24/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.25/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.26/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.27/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.13.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.14.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.14.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.15.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.15.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.16.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.16.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.16.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.17.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.17.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.18.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.18.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.19.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.19.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.2.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.19/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.20/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.21/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.22/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.23/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.24/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.25/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.26/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.27/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.28/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.29/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.30/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.20.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.21.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.21.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.22.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.3.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.3.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.13/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.16/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.17/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.18/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.19/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.5.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/8/8.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.0.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.1.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.1.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.10.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.10.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.10.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.11.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.11.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.11.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.11.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.12.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.12.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.12.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.12.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.14.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.16.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.17.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.2.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.2.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.3.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.3.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.3.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.10/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.11/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.12/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.14/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.15/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.3/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.6/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.7/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.8/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.4.9/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.7.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.7.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.7.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.8.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.8.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.8.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.9.0/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.9.1/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/9/9.9.2/kaniko-build.py delete mode 100644 linux/ecosystem/atlassian/jira/latest/kaniko-build.py delete mode 100644 linux/ecosystem/cassandra/3.11/kaniko-build.py delete mode 100644 linux/ecosystem/electron-release-server/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/astra/1.7-alse/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/06-squeeze/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/07-wheezy/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/08-jessie/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/09-stretch/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/10-buster/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/11-bullseye/slim/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/develop/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/main/kaniko-build.py delete mode 100644 linux/ecosystem/epicmorg/debian/12-bookworm/slim/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/amxx-sdk/1.10/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/amxx-sdk/1.9/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/android-sdk/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/android-sdk/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/android-sdk/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/atlassian-sdk/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/dotnet-sdk/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/latest/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node0.12/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node10/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node11/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node12/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node13/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node14/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node15/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node16/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node17/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node18/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node19/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node20/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node21/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node22/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node4/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node5/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node6/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node7/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node8/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/node9/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php7.2/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php7.3/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php7.4/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php8.0/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php8.1/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php8.2/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/php8.3/kaniko-build.py delete mode 100644 linux/ecosystem/gitlab/runner/steam-sdk/kaniko-build.py delete mode 100644 linux/ecosystem/monero/monerod/kaniko-build.py delete mode 100644 linux/ecosystem/monero/p2pool/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.14.2/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.14.2/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.14.2/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.15.12/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.15.12/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.15.12/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.16.1/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.16.1/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.16.1/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.17.10/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.17.10/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.17.10/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.18.0/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.18.0/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.18.0/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.19.10/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.19.10/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.19.10/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.20.1/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.20.1/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.20.1/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.21.3/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.21.3/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.21.3/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.21.6/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.21.6/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.21.6/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/1.27.0/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/latest/mainline/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/latest/mainline/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/latest/mainline/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/latest/quic/main/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/latest/quic/php/kaniko-build.py delete mode 100644 linux/ecosystem/nginx/latest/quic/rtmp-hls/kaniko-build.py delete mode 100644 linux/ecosystem/ninjam/latest/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/current/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/lts/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node0.12/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node10/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node11/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node12/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node13/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node14/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node15/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node16/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node17/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node18/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node19/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node20/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node21/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node22/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node4/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node5/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node6/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node7/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node8/kaniko-build.py delete mode 100644 linux/ecosystem/nodejs/node9/kaniko-build.py delete mode 100644 linux/ecosystem/opentracker/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r16.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r17.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r17.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r18.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r18.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r19.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r19.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r20.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r20.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r21.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r21.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r22.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r23.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/base/r23.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r16.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r17.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r17.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r18.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r18.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r19.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r19.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r20.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r20.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r21.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r21.2/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r22.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r23.1/kaniko-build.py delete mode 100644 linux/ecosystem/perforce/p4p/r23.2/kaniko-build.py delete mode 100644 linux/ecosystem/php/php5.5/kaniko-build.py delete mode 100644 linux/ecosystem/php/php7.0/kaniko-build.py delete mode 100644 linux/ecosystem/php/php7.1/kaniko-build.py delete mode 100644 linux/ecosystem/php/php7.2/kaniko-build.py delete mode 100644 linux/ecosystem/php/php7.3/kaniko-build.py delete mode 100644 linux/ecosystem/php/php7.4/kaniko-build.py delete mode 100644 linux/ecosystem/php/php8.0/kaniko-build.py delete mode 100644 linux/ecosystem/php/php8.1/kaniko-build.py delete mode 100644 linux/ecosystem/php/php8.2/kaniko-build.py delete mode 100644 linux/ecosystem/php/php8.3/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/10/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/11/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/12/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/13/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/14/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/15/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/16/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/8.2/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/8.3/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/8.4/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.0/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.1/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.2/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.3/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.4/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.5/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/9.6/kaniko-build.py delete mode 100644 linux/ecosystem/postgres/latest/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.4.0/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.4.1/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.4.2/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.4.3.1/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.4.4/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.4.5/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.5.0/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.5.1/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.5.2/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.5.3/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.5.4/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.5.5/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.6.0/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.6.1/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.6.2/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.6.3/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/4.6.4/kaniko-build.py delete mode 100644 linux/ecosystem/qbittorrent/testing/kaniko-build.py delete mode 100644 linux/ecosystem/retracker/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/amxx-sdk/1.10/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/amxx-sdk/1.9/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/android-sdk/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/android-sdk/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/android-sdk/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/atlassian-sdk/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/dotnet-sdk/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/latest/jdk11/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/latest/jdk17/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/latest/jdk21/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/latest/jdk8/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node0.12/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node10/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node11/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node12/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node13/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node14/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node15/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node16/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node17/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node18/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node19/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node20/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node21/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node22/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node4/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node5/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node6/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node7/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node8/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/node9/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php7.2/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php7.3/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php7.4/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php8.0/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php8.1/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php8.2/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/php8.3/kaniko-build.py delete mode 100644 linux/ecosystem/teamcity/agent/steam-sdk/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.4.1.3669/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.4.1.3669/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.4.1.3669/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3727/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3727/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3727/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3731/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3731/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3731/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3735/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3735/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.0.3735/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.1.3746/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.1.3746/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.5.1.3746/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3853/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3853/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3853/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3856/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3856/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3856/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3861/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3861/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3861/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3862/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3862/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3862/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3865/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3865/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.6.0.3865/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3938/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3938/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3938/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3942/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3942/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3942/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3951/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3951/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.0.3951/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.1.4026/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.1.4026/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.1.4026/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.1.4028/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.1.4028/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/5.7.1.4028/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.0.0.4140/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.0.0.4140/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.0.0.4140/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.0.1.4163/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.0.1.4163/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.0.1.4163/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.0.4367/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.0.4367/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.0.4367/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.0.4369/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.0.4369/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.0.4369/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.1.1020/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.1.1020/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.1.1020/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.1.1021/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.1.1021/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.1.1.1021/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.0.1085/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.0.1085/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.0.1085/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.1.1003/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.1.1003/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.1.1003/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.1.1005/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.1.1005/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.1.1005/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.2.1107/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.2.1107/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.2.1107/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.3.1114/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.3.1114/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.2.3.1114/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.0.1120/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.0.1120/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.0.1120/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.1.1004/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.1.1004/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.1.1004/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.1.1006/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.1.1006/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.3.1.1006/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.4.0.1284/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.4.0.1284/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.4.0.1284/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.4.0.1293/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.4.0.1293/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.4.0.1293/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.0.1298/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.0.1298/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.0.1298/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.1.1002/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.1.1002/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.1.1002/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.3.1001/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.3.1001/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.3.1001/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.4.1002/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.4.1002/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.4.1002/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.4.1007/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.4.1007/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.4.1007/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.5.1009/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.5.1009/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.5.1009/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.6.1014/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.6.1014/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.6.1014/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.7.1000/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.7.1000/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.5.7.1000/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.6.0.1156/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.6.0.1156/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.6.0.1156/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.6.1.1166/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.6.1.1166/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.6.1.1166/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.1.1020/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.1.1020/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.1.1020/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.2.1037/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.2.1037/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.2.1037/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.2.1043/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.2.1043/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/6.7.2.1043/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.0.1057/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.0.1057/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.0.1057/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.1.1002/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.1.1002/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.1.1002/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.1.1013/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.1.1013/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.1.1013/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1014/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1014/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1014/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1015/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1015/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1015/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1016/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1016/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.0.2.1016/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8079/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8079/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8079/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8091/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8091/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8091/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8092/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8092/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.4.1.8092/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7010/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7010/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7010/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7012/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7012/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7012/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7013/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7013/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.1.7013/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.2.1002/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.2.1002/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.2.1002/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.3.1000/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.3.1000/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/7.5.3.1000/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/8.0.0.1089/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/8.0.0.1089/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/8.0.0.1089/main/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/8.0.1.1029/ad/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/8.0.1.1029/ldap/kaniko-build.py delete mode 100644 linux/ecosystem/testrail/8.0.1.1029/main/kaniko-build.py delete mode 100644 linux/ecosystem/torrserver/kaniko-build.py delete mode 100644 linux/ecosystem/torrust-index/kaniko-build.py delete mode 100644 linux/ecosystem/torrust-tracker/kaniko-build.py delete mode 100644 linux/ecosystem/vk2discord/kaniko-build.py diff --git a/bin/ansible/roles/atlassian.bitbucket/files/Makefile b/bin/ansible/roles/atlassian.bitbucket/files/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/atlassian.bitbucket/files/Makefile +++ b/bin/ansible/roles/atlassian.bitbucket/files/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/atlassian.bitbucket/files/kaniko-build.py b/bin/ansible/roles/atlassian.bitbucket/files/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/atlassian.bitbucket/files/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/atlassian.jira/files/Makefile b/bin/ansible/roles/atlassian.jira/files/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/atlassian.jira/files/Makefile +++ b/bin/ansible/roles/atlassian.jira/files/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/atlassian.jira/files/kaniko-build.py b/bin/ansible/roles/atlassian.jira/files/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/atlassian.jira/files/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php70/ad/Makefile b/bin/ansible/roles/gurock.testrail/files/php70/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php70/ad/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php70/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php70/ad/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php70/ad/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php70/ad/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php70/ldap/Makefile b/bin/ansible/roles/gurock.testrail/files/php70/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php70/ldap/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php70/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php70/ldap/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php70/ldap/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php70/ldap/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php70/main/Makefile b/bin/ansible/roles/gurock.testrail/files/php70/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php70/main/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php70/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php70/main/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php70/main/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php70/main/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php71/ad/Makefile b/bin/ansible/roles/gurock.testrail/files/php71/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php71/ad/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php71/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php71/ad/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php71/ad/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php71/ad/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php71/ldap/Makefile b/bin/ansible/roles/gurock.testrail/files/php71/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php71/ldap/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php71/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php71/ldap/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php71/ldap/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php71/ldap/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php71/main/Makefile b/bin/ansible/roles/gurock.testrail/files/php71/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php71/main/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php71/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php71/main/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php71/main/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php71/main/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php72/ad/Makefile b/bin/ansible/roles/gurock.testrail/files/php72/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php72/ad/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php72/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php72/ad/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php72/ad/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php72/ad/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php72/ldap/Makefile b/bin/ansible/roles/gurock.testrail/files/php72/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php72/ldap/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php72/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php72/ldap/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php72/ldap/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php72/ldap/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php72/main/Makefile b/bin/ansible/roles/gurock.testrail/files/php72/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php72/main/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php72/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php72/main/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php72/main/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php72/main/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php74/ad/Makefile b/bin/ansible/roles/gurock.testrail/files/php74/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php74/ad/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php74/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php74/ad/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php74/ad/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php74/ad/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php74/ldap/Makefile b/bin/ansible/roles/gurock.testrail/files/php74/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php74/ldap/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php74/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php74/ldap/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php74/ldap/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php74/ldap/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php74/main/Makefile b/bin/ansible/roles/gurock.testrail/files/php74/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php74/main/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php74/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php74/main/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php74/main/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php74/main/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php81/ad/Makefile b/bin/ansible/roles/gurock.testrail/files/php81/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php81/ad/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php81/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php81/ad/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php81/ad/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php81/ad/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php81/ldap/Makefile b/bin/ansible/roles/gurock.testrail/files/php81/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php81/ldap/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php81/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php81/ldap/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php81/ldap/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php81/ldap/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/ansible/roles/gurock.testrail/files/php81/main/Makefile b/bin/ansible/roles/gurock.testrail/files/php81/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/bin/ansible/roles/gurock.testrail/files/php81/main/Makefile +++ b/bin/ansible/roles/gurock.testrail/files/php81/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/bin/ansible/roles/gurock.testrail/files/php81/main/kaniko-build.py b/bin/ansible/roles/gurock.testrail/files/php81/main/kaniko-build.py deleted file mode 100644 index e2034145c..000000000 --- a/bin/ansible/roles/gurock.testrail/files/php81/main/kaniko-build.py +++ /dev/null @@ -1,194 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.0.1" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - try: - future.result() - except Exception as exc: - logging.error(f"Generated an exception: {exc}") - -if __name__ == '__main__': - main() diff --git a/bin/kaniko/_deploy.py b/bin/kaniko/_deploy.py index 8d874fc0a..0a8b640a8 100644 --- a/bin/kaniko/_deploy.py +++ b/bin/kaniko/_deploy.py @@ -27,7 +27,7 @@ def main(): ignore_directory = os.path.join(root_directory, 'win32') # List of files to copy - files_to_copy = ['kaniko-build.py', 'requirements.txt'] + files_to_copy = ['requirements.txt'] # Check if the source files exist in the script directory for file_name in files_to_copy: diff --git a/bin/kaniko/kaniko-build.py b/bin/kaniko/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/bin/kaniko/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/bin/kaniko/requirements.txt b/bin/kaniko/requirements.txt index 9ed771861..568608d59 100644 --- a/bin/kaniko/requirements.txt +++ b/bin/kaniko/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/mattermost/Makefile b/linux/advanced/mattermost/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/mattermost/Makefile +++ b/linux/advanced/mattermost/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/mattermost/kaniko-build.py b/linux/advanced/mattermost/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/mattermost/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/mattermost/requirements.txt b/linux/advanced/mattermost/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/mattermost/requirements.txt +++ b/linux/advanced/mattermost/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/14/Makefile b/linux/advanced/nextcloud/patched/14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/14/Makefile +++ b/linux/advanced/nextcloud/patched/14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/14/kaniko-build.py b/linux/advanced/nextcloud/patched/14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/14/requirements.txt b/linux/advanced/nextcloud/patched/14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/14/requirements.txt +++ b/linux/advanced/nextcloud/patched/14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/15/Makefile b/linux/advanced/nextcloud/patched/15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/15/Makefile +++ b/linux/advanced/nextcloud/patched/15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/15/kaniko-build.py b/linux/advanced/nextcloud/patched/15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/15/requirements.txt b/linux/advanced/nextcloud/patched/15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/15/requirements.txt +++ b/linux/advanced/nextcloud/patched/15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/16/Makefile b/linux/advanced/nextcloud/patched/16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/16/Makefile +++ b/linux/advanced/nextcloud/patched/16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/16/kaniko-build.py b/linux/advanced/nextcloud/patched/16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/16/requirements.txt b/linux/advanced/nextcloud/patched/16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/16/requirements.txt +++ b/linux/advanced/nextcloud/patched/16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/17/Makefile b/linux/advanced/nextcloud/patched/17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/17/Makefile +++ b/linux/advanced/nextcloud/patched/17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/17/kaniko-build.py b/linux/advanced/nextcloud/patched/17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/17/requirements.txt b/linux/advanced/nextcloud/patched/17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/17/requirements.txt +++ b/linux/advanced/nextcloud/patched/17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/18/Makefile b/linux/advanced/nextcloud/patched/18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/18/Makefile +++ b/linux/advanced/nextcloud/patched/18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/18/kaniko-build.py b/linux/advanced/nextcloud/patched/18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/18/requirements.txt b/linux/advanced/nextcloud/patched/18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/18/requirements.txt +++ b/linux/advanced/nextcloud/patched/18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/19/Makefile b/linux/advanced/nextcloud/patched/19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/19/Makefile +++ b/linux/advanced/nextcloud/patched/19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/19/kaniko-build.py b/linux/advanced/nextcloud/patched/19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/19/requirements.txt b/linux/advanced/nextcloud/patched/19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/19/requirements.txt +++ b/linux/advanced/nextcloud/patched/19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/20/Makefile b/linux/advanced/nextcloud/patched/20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/20/Makefile +++ b/linux/advanced/nextcloud/patched/20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/20/kaniko-build.py b/linux/advanced/nextcloud/patched/20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/20/requirements.txt b/linux/advanced/nextcloud/patched/20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/20/requirements.txt +++ b/linux/advanced/nextcloud/patched/20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/21/Makefile b/linux/advanced/nextcloud/patched/21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/21/Makefile +++ b/linux/advanced/nextcloud/patched/21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/21/kaniko-build.py b/linux/advanced/nextcloud/patched/21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/21/requirements.txt b/linux/advanced/nextcloud/patched/21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/21/requirements.txt +++ b/linux/advanced/nextcloud/patched/21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/22/Makefile b/linux/advanced/nextcloud/patched/22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/22/Makefile +++ b/linux/advanced/nextcloud/patched/22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/22/kaniko-build.py b/linux/advanced/nextcloud/patched/22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/22/requirements.txt b/linux/advanced/nextcloud/patched/22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/22/requirements.txt +++ b/linux/advanced/nextcloud/patched/22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/23/Makefile b/linux/advanced/nextcloud/patched/23/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/23/Makefile +++ b/linux/advanced/nextcloud/patched/23/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/23/kaniko-build.py b/linux/advanced/nextcloud/patched/23/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/23/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/23/requirements.txt b/linux/advanced/nextcloud/patched/23/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/23/requirements.txt +++ b/linux/advanced/nextcloud/patched/23/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/24/Makefile b/linux/advanced/nextcloud/patched/24/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/24/Makefile +++ b/linux/advanced/nextcloud/patched/24/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/24/kaniko-build.py b/linux/advanced/nextcloud/patched/24/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/24/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/24/requirements.txt b/linux/advanced/nextcloud/patched/24/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/24/requirements.txt +++ b/linux/advanced/nextcloud/patched/24/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/25/Makefile b/linux/advanced/nextcloud/patched/25/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/25/Makefile +++ b/linux/advanced/nextcloud/patched/25/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/25/kaniko-build.py b/linux/advanced/nextcloud/patched/25/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/25/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/25/requirements.txt b/linux/advanced/nextcloud/patched/25/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/25/requirements.txt +++ b/linux/advanced/nextcloud/patched/25/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/26/Makefile b/linux/advanced/nextcloud/patched/26/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/26/Makefile +++ b/linux/advanced/nextcloud/patched/26/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/26/kaniko-build.py b/linux/advanced/nextcloud/patched/26/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/26/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/26/requirements.txt b/linux/advanced/nextcloud/patched/26/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/26/requirements.txt +++ b/linux/advanced/nextcloud/patched/26/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/27/Makefile b/linux/advanced/nextcloud/patched/27/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/27/Makefile +++ b/linux/advanced/nextcloud/patched/27/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/27/kaniko-build.py b/linux/advanced/nextcloud/patched/27/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/27/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/27/requirements.txt b/linux/advanced/nextcloud/patched/27/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/27/requirements.txt +++ b/linux/advanced/nextcloud/patched/27/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/28/Makefile b/linux/advanced/nextcloud/patched/28/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/28/Makefile +++ b/linux/advanced/nextcloud/patched/28/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/28/kaniko-build.py b/linux/advanced/nextcloud/patched/28/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/28/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/28/requirements.txt b/linux/advanced/nextcloud/patched/28/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/28/requirements.txt +++ b/linux/advanced/nextcloud/patched/28/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/29/Makefile b/linux/advanced/nextcloud/patched/29/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/29/Makefile +++ b/linux/advanced/nextcloud/patched/29/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/29/kaniko-build.py b/linux/advanced/nextcloud/patched/29/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/29/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/29/requirements.txt b/linux/advanced/nextcloud/patched/29/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/29/requirements.txt +++ b/linux/advanced/nextcloud/patched/29/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/patched/latest/Makefile b/linux/advanced/nextcloud/patched/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/patched/latest/Makefile +++ b/linux/advanced/nextcloud/patched/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/patched/latest/kaniko-build.py b/linux/advanced/nextcloud/patched/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/patched/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/patched/latest/requirements.txt b/linux/advanced/nextcloud/patched/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/patched/latest/requirements.txt +++ b/linux/advanced/nextcloud/patched/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/14/Makefile b/linux/advanced/nextcloud/pure/14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/14/Makefile +++ b/linux/advanced/nextcloud/pure/14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/14/kaniko-build.py b/linux/advanced/nextcloud/pure/14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/14/requirements.txt b/linux/advanced/nextcloud/pure/14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/14/requirements.txt +++ b/linux/advanced/nextcloud/pure/14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/15/Makefile b/linux/advanced/nextcloud/pure/15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/15/Makefile +++ b/linux/advanced/nextcloud/pure/15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/15/kaniko-build.py b/linux/advanced/nextcloud/pure/15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/15/requirements.txt b/linux/advanced/nextcloud/pure/15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/15/requirements.txt +++ b/linux/advanced/nextcloud/pure/15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/16/Makefile b/linux/advanced/nextcloud/pure/16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/16/Makefile +++ b/linux/advanced/nextcloud/pure/16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/16/kaniko-build.py b/linux/advanced/nextcloud/pure/16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/16/requirements.txt b/linux/advanced/nextcloud/pure/16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/16/requirements.txt +++ b/linux/advanced/nextcloud/pure/16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/17/Makefile b/linux/advanced/nextcloud/pure/17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/17/Makefile +++ b/linux/advanced/nextcloud/pure/17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/17/kaniko-build.py b/linux/advanced/nextcloud/pure/17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/17/requirements.txt b/linux/advanced/nextcloud/pure/17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/17/requirements.txt +++ b/linux/advanced/nextcloud/pure/17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/18/Makefile b/linux/advanced/nextcloud/pure/18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/18/Makefile +++ b/linux/advanced/nextcloud/pure/18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/18/kaniko-build.py b/linux/advanced/nextcloud/pure/18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/18/requirements.txt b/linux/advanced/nextcloud/pure/18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/18/requirements.txt +++ b/linux/advanced/nextcloud/pure/18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/19/Makefile b/linux/advanced/nextcloud/pure/19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/19/Makefile +++ b/linux/advanced/nextcloud/pure/19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/19/kaniko-build.py b/linux/advanced/nextcloud/pure/19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/19/requirements.txt b/linux/advanced/nextcloud/pure/19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/19/requirements.txt +++ b/linux/advanced/nextcloud/pure/19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/20/Makefile b/linux/advanced/nextcloud/pure/20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/20/Makefile +++ b/linux/advanced/nextcloud/pure/20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/20/kaniko-build.py b/linux/advanced/nextcloud/pure/20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/20/requirements.txt b/linux/advanced/nextcloud/pure/20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/20/requirements.txt +++ b/linux/advanced/nextcloud/pure/20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/21/Makefile b/linux/advanced/nextcloud/pure/21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/21/Makefile +++ b/linux/advanced/nextcloud/pure/21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/21/kaniko-build.py b/linux/advanced/nextcloud/pure/21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/21/requirements.txt b/linux/advanced/nextcloud/pure/21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/21/requirements.txt +++ b/linux/advanced/nextcloud/pure/21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/22/Makefile b/linux/advanced/nextcloud/pure/22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/22/Makefile +++ b/linux/advanced/nextcloud/pure/22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/22/kaniko-build.py b/linux/advanced/nextcloud/pure/22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/22/requirements.txt b/linux/advanced/nextcloud/pure/22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/22/requirements.txt +++ b/linux/advanced/nextcloud/pure/22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/23/Makefile b/linux/advanced/nextcloud/pure/23/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/23/Makefile +++ b/linux/advanced/nextcloud/pure/23/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/23/kaniko-build.py b/linux/advanced/nextcloud/pure/23/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/23/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/23/requirements.txt b/linux/advanced/nextcloud/pure/23/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/23/requirements.txt +++ b/linux/advanced/nextcloud/pure/23/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/24/Makefile b/linux/advanced/nextcloud/pure/24/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/24/Makefile +++ b/linux/advanced/nextcloud/pure/24/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/24/kaniko-build.py b/linux/advanced/nextcloud/pure/24/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/24/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/24/requirements.txt b/linux/advanced/nextcloud/pure/24/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/24/requirements.txt +++ b/linux/advanced/nextcloud/pure/24/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/25/Makefile b/linux/advanced/nextcloud/pure/25/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/25/Makefile +++ b/linux/advanced/nextcloud/pure/25/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/25/kaniko-build.py b/linux/advanced/nextcloud/pure/25/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/25/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/25/requirements.txt b/linux/advanced/nextcloud/pure/25/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/25/requirements.txt +++ b/linux/advanced/nextcloud/pure/25/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/26/Makefile b/linux/advanced/nextcloud/pure/26/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/26/Makefile +++ b/linux/advanced/nextcloud/pure/26/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/26/kaniko-build.py b/linux/advanced/nextcloud/pure/26/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/26/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/26/requirements.txt b/linux/advanced/nextcloud/pure/26/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/26/requirements.txt +++ b/linux/advanced/nextcloud/pure/26/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/27/Makefile b/linux/advanced/nextcloud/pure/27/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/27/Makefile +++ b/linux/advanced/nextcloud/pure/27/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/27/kaniko-build.py b/linux/advanced/nextcloud/pure/27/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/27/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/27/requirements.txt b/linux/advanced/nextcloud/pure/27/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/27/requirements.txt +++ b/linux/advanced/nextcloud/pure/27/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/28/Makefile b/linux/advanced/nextcloud/pure/28/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/28/Makefile +++ b/linux/advanced/nextcloud/pure/28/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/28/kaniko-build.py b/linux/advanced/nextcloud/pure/28/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/28/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/28/requirements.txt b/linux/advanced/nextcloud/pure/28/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/28/requirements.txt +++ b/linux/advanced/nextcloud/pure/28/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/29/Makefile b/linux/advanced/nextcloud/pure/29/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/29/Makefile +++ b/linux/advanced/nextcloud/pure/29/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/29/kaniko-build.py b/linux/advanced/nextcloud/pure/29/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/29/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/29/requirements.txt b/linux/advanced/nextcloud/pure/29/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/29/requirements.txt +++ b/linux/advanced/nextcloud/pure/29/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/nextcloud/pure/latest/Makefile b/linux/advanced/nextcloud/pure/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/nextcloud/pure/latest/Makefile +++ b/linux/advanced/nextcloud/pure/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/nextcloud/pure/latest/kaniko-build.py b/linux/advanced/nextcloud/pure/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/nextcloud/pure/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/nextcloud/pure/latest/requirements.txt b/linux/advanced/nextcloud/pure/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/nextcloud/pure/latest/requirements.txt +++ b/linux/advanced/nextcloud/pure/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/2.7/Makefile b/linux/advanced/python/develop/2.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/2.7/Makefile +++ b/linux/advanced/python/develop/2.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/2.7/kaniko-build.py b/linux/advanced/python/develop/2.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/2.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/2.7/requirements.txt b/linux/advanced/python/develop/2.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/2.7/requirements.txt +++ b/linux/advanced/python/develop/2.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.10/Makefile b/linux/advanced/python/develop/3.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.10/Makefile +++ b/linux/advanced/python/develop/3.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.10/kaniko-build.py b/linux/advanced/python/develop/3.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.10/requirements.txt b/linux/advanced/python/develop/3.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.10/requirements.txt +++ b/linux/advanced/python/develop/3.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.11/Makefile b/linux/advanced/python/develop/3.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.11/Makefile +++ b/linux/advanced/python/develop/3.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.11/kaniko-build.py b/linux/advanced/python/develop/3.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.11/requirements.txt b/linux/advanced/python/develop/3.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.11/requirements.txt +++ b/linux/advanced/python/develop/3.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.12/Makefile b/linux/advanced/python/develop/3.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.12/Makefile +++ b/linux/advanced/python/develop/3.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.12/kaniko-build.py b/linux/advanced/python/develop/3.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.12/requirements.txt b/linux/advanced/python/develop/3.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.12/requirements.txt +++ b/linux/advanced/python/develop/3.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.13/Makefile b/linux/advanced/python/develop/3.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.13/Makefile +++ b/linux/advanced/python/develop/3.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.13/kaniko-build.py b/linux/advanced/python/develop/3.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.13/requirements.txt b/linux/advanced/python/develop/3.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.13/requirements.txt +++ b/linux/advanced/python/develop/3.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.6/Makefile b/linux/advanced/python/develop/3.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.6/Makefile +++ b/linux/advanced/python/develop/3.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.6/kaniko-build.py b/linux/advanced/python/develop/3.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.6/requirements.txt b/linux/advanced/python/develop/3.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.6/requirements.txt +++ b/linux/advanced/python/develop/3.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.7/Makefile b/linux/advanced/python/develop/3.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.7/Makefile +++ b/linux/advanced/python/develop/3.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.7/kaniko-build.py b/linux/advanced/python/develop/3.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.7/requirements.txt b/linux/advanced/python/develop/3.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.7/requirements.txt +++ b/linux/advanced/python/develop/3.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.8/Makefile b/linux/advanced/python/develop/3.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.8/Makefile +++ b/linux/advanced/python/develop/3.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.8/kaniko-build.py b/linux/advanced/python/develop/3.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.8/requirements.txt b/linux/advanced/python/develop/3.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.8/requirements.txt +++ b/linux/advanced/python/develop/3.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/develop/3.9/Makefile b/linux/advanced/python/develop/3.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/develop/3.9/Makefile +++ b/linux/advanced/python/develop/3.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/develop/3.9/kaniko-build.py b/linux/advanced/python/develop/3.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/develop/3.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/develop/3.9/requirements.txt b/linux/advanced/python/develop/3.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/develop/3.9/requirements.txt +++ b/linux/advanced/python/develop/3.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/2.7/Makefile b/linux/advanced/python/main/2.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/2.7/Makefile +++ b/linux/advanced/python/main/2.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/2.7/kaniko-build.py b/linux/advanced/python/main/2.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/2.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/2.7/requirements.txt b/linux/advanced/python/main/2.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/2.7/requirements.txt +++ b/linux/advanced/python/main/2.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.10/Makefile b/linux/advanced/python/main/3.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.10/Makefile +++ b/linux/advanced/python/main/3.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.10/kaniko-build.py b/linux/advanced/python/main/3.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.10/requirements.txt b/linux/advanced/python/main/3.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.10/requirements.txt +++ b/linux/advanced/python/main/3.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.11/Makefile b/linux/advanced/python/main/3.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.11/Makefile +++ b/linux/advanced/python/main/3.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.11/kaniko-build.py b/linux/advanced/python/main/3.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.11/requirements.txt b/linux/advanced/python/main/3.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.11/requirements.txt +++ b/linux/advanced/python/main/3.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.12/Makefile b/linux/advanced/python/main/3.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.12/Makefile +++ b/linux/advanced/python/main/3.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.12/kaniko-build.py b/linux/advanced/python/main/3.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.12/requirements.txt b/linux/advanced/python/main/3.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.12/requirements.txt +++ b/linux/advanced/python/main/3.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.13/Makefile b/linux/advanced/python/main/3.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.13/Makefile +++ b/linux/advanced/python/main/3.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.13/kaniko-build.py b/linux/advanced/python/main/3.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.13/requirements.txt b/linux/advanced/python/main/3.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.13/requirements.txt +++ b/linux/advanced/python/main/3.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.6/Makefile b/linux/advanced/python/main/3.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.6/Makefile +++ b/linux/advanced/python/main/3.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.6/kaniko-build.py b/linux/advanced/python/main/3.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.6/requirements.txt b/linux/advanced/python/main/3.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.6/requirements.txt +++ b/linux/advanced/python/main/3.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.7/Makefile b/linux/advanced/python/main/3.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.7/Makefile +++ b/linux/advanced/python/main/3.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.7/kaniko-build.py b/linux/advanced/python/main/3.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.7/requirements.txt b/linux/advanced/python/main/3.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.7/requirements.txt +++ b/linux/advanced/python/main/3.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.8/Makefile b/linux/advanced/python/main/3.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.8/Makefile +++ b/linux/advanced/python/main/3.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.8/kaniko-build.py b/linux/advanced/python/main/3.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.8/requirements.txt b/linux/advanced/python/main/3.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.8/requirements.txt +++ b/linux/advanced/python/main/3.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/python/main/3.9/Makefile b/linux/advanced/python/main/3.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/python/main/3.9/Makefile +++ b/linux/advanced/python/main/3.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/python/main/3.9/kaniko-build.py b/linux/advanced/python/main/3.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/python/main/3.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/python/main/3.9/requirements.txt b/linux/advanced/python/main/3.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/python/main/3.9/requirements.txt +++ b/linux/advanced/python/main/3.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/redash/Makefile b/linux/advanced/redash/Makefile index 5927219c1..c7062c47e 100644 --- a/linux/advanced/redash/Makefile +++ b/linux/advanced/redash/Makefile @@ -20,7 +20,7 @@ patch: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -29,7 +29,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -48,7 +48,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/sentry/latest/Makefile b/linux/advanced/sentry/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/sentry/latest/Makefile +++ b/linux/advanced/sentry/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/sentry/latest/kaniko-build.py b/linux/advanced/sentry/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/sentry/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/sentry/latest/requirements.txt b/linux/advanced/sentry/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/sentry/latest/requirements.txt +++ b/linux/advanced/sentry/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/teamcity/server/Makefile b/linux/advanced/teamcity/server/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/teamcity/server/Makefile +++ b/linux/advanced/teamcity/server/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/teamcity/server/kaniko-build.py b/linux/advanced/teamcity/server/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/teamcity/server/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/teamcity/server/requirements.txt b/linux/advanced/teamcity/server/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/teamcity/server/requirements.txt +++ b/linux/advanced/teamcity/server/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/amxx/1.10/Makefile b/linux/advanced/vscode-server/amxx/1.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/amxx/1.10/Makefile +++ b/linux/advanced/vscode-server/amxx/1.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/amxx/1.10/kaniko-build.py b/linux/advanced/vscode-server/amxx/1.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/amxx/1.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/amxx/1.10/requirements.txt b/linux/advanced/vscode-server/amxx/1.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/amxx/1.10/requirements.txt +++ b/linux/advanced/vscode-server/amxx/1.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/amxx/1.9/Makefile b/linux/advanced/vscode-server/amxx/1.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/amxx/1.9/Makefile +++ b/linux/advanced/vscode-server/amxx/1.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/amxx/1.9/kaniko-build.py b/linux/advanced/vscode-server/amxx/1.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/amxx/1.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/amxx/1.9/requirements.txt b/linux/advanced/vscode-server/amxx/1.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/amxx/1.9/requirements.txt +++ b/linux/advanced/vscode-server/amxx/1.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/android/Makefile b/linux/advanced/vscode-server/android/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/android/Makefile +++ b/linux/advanced/vscode-server/android/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/android/kaniko-build.py b/linux/advanced/vscode-server/android/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/android/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/android/requirements.txt b/linux/advanced/vscode-server/android/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/android/requirements.txt +++ b/linux/advanced/vscode-server/android/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/cpp/Makefile b/linux/advanced/vscode-server/cpp/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/cpp/Makefile +++ b/linux/advanced/vscode-server/cpp/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/cpp/kaniko-build.py b/linux/advanced/vscode-server/cpp/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/cpp/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/cpp/requirements.txt b/linux/advanced/vscode-server/cpp/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/cpp/requirements.txt +++ b/linux/advanced/vscode-server/cpp/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/devops/Makefile b/linux/advanced/vscode-server/devops/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/devops/Makefile +++ b/linux/advanced/vscode-server/devops/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/devops/kaniko-build.py b/linux/advanced/vscode-server/devops/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/devops/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/devops/requirements.txt b/linux/advanced/vscode-server/devops/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/devops/requirements.txt +++ b/linux/advanced/vscode-server/devops/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/docker/Makefile b/linux/advanced/vscode-server/docker/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/docker/Makefile +++ b/linux/advanced/vscode-server/docker/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/docker/kaniko-build.py b/linux/advanced/vscode-server/docker/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/docker/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/docker/requirements.txt b/linux/advanced/vscode-server/docker/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/docker/requirements.txt +++ b/linux/advanced/vscode-server/docker/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/dotnet-full/Makefile b/linux/advanced/vscode-server/dotnet-full/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/dotnet-full/Makefile +++ b/linux/advanced/vscode-server/dotnet-full/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/dotnet-full/kaniko-build.py b/linux/advanced/vscode-server/dotnet-full/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/dotnet-full/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/dotnet-full/requirements.txt b/linux/advanced/vscode-server/dotnet-full/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/dotnet-full/requirements.txt +++ b/linux/advanced/vscode-server/dotnet-full/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/dotnet/Makefile b/linux/advanced/vscode-server/dotnet/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/dotnet/Makefile +++ b/linux/advanced/vscode-server/dotnet/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/dotnet/kaniko-build.py b/linux/advanced/vscode-server/dotnet/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/dotnet/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/dotnet/requirements.txt b/linux/advanced/vscode-server/dotnet/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/dotnet/requirements.txt +++ b/linux/advanced/vscode-server/dotnet/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/latest/Makefile b/linux/advanced/vscode-server/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/latest/Makefile +++ b/linux/advanced/vscode-server/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/latest/kaniko-build.py b/linux/advanced/vscode-server/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/latest/requirements.txt b/linux/advanced/vscode-server/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/latest/requirements.txt +++ b/linux/advanced/vscode-server/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/vscode-server/mono/Makefile b/linux/advanced/vscode-server/mono/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/vscode-server/mono/Makefile +++ b/linux/advanced/vscode-server/mono/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/vscode-server/mono/kaniko-build.py b/linux/advanced/vscode-server/mono/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/vscode-server/mono/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/vscode-server/mono/requirements.txt b/linux/advanced/vscode-server/mono/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/vscode-server/mono/requirements.txt +++ b/linux/advanced/vscode-server/mono/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/agent/Makefile b/linux/advanced/zabbix/3.0/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/agent/Makefile +++ b/linux/advanced/zabbix/3.0/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/agent/kaniko-build.py b/linux/advanced/zabbix/3.0/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/agent/requirements.txt b/linux/advanced/zabbix/3.0/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/agent/requirements.txt +++ b/linux/advanced/zabbix/3.0/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/java-gateway/Makefile b/linux/advanced/zabbix/3.0/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/java-gateway/Makefile +++ b/linux/advanced/zabbix/3.0/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/java-gateway/kaniko-build.py b/linux/advanced/zabbix/3.0/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/java-gateway/requirements.txt b/linux/advanced/zabbix/3.0/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/3.0/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/proxy-mysql/Makefile b/linux/advanced/zabbix/3.0/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/3.0/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/3.0/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/proxy-mysql/requirements.txt b/linux/advanced/zabbix/3.0/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/3.0/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/proxy-sqlite3/Makefile b/linux/advanced/zabbix/3.0/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/3.0/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/3.0/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/3.0/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/3.0/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/server-mysql/Makefile b/linux/advanced/zabbix/3.0/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/server-mysql/Makefile +++ b/linux/advanced/zabbix/3.0/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/server-mysql/kaniko-build.py b/linux/advanced/zabbix/3.0/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/server-mysql/requirements.txt b/linux/advanced/zabbix/3.0/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/3.0/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/server-pgsql/Makefile b/linux/advanced/zabbix/3.0/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/server-pgsql/Makefile +++ b/linux/advanced/zabbix/3.0/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/3.0/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/server-pgsql/requirements.txt b/linux/advanced/zabbix/3.0/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/3.0/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/snmptraps/Makefile b/linux/advanced/zabbix/3.0/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/snmptraps/Makefile +++ b/linux/advanced/zabbix/3.0/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/snmptraps/kaniko-build.py b/linux/advanced/zabbix/3.0/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/snmptraps/requirements.txt b/linux/advanced/zabbix/3.0/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/3.0/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/web-mysql/Makefile b/linux/advanced/zabbix/3.0/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/web-mysql/Makefile +++ b/linux/advanced/zabbix/3.0/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/web-mysql/kaniko-build.py b/linux/advanced/zabbix/3.0/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/web-mysql/requirements.txt b/linux/advanced/zabbix/3.0/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/3.0/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/3.0/web-pgsql/Makefile b/linux/advanced/zabbix/3.0/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/3.0/web-pgsql/Makefile +++ b/linux/advanced/zabbix/3.0/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/3.0/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/3.0/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/3.0/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/3.0/web-pgsql/requirements.txt b/linux/advanced/zabbix/3.0/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/3.0/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/3.0/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/agent/Makefile b/linux/advanced/zabbix/4.0/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/agent/Makefile +++ b/linux/advanced/zabbix/4.0/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/agent/kaniko-build.py b/linux/advanced/zabbix/4.0/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/agent/requirements.txt b/linux/advanced/zabbix/4.0/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/agent/requirements.txt +++ b/linux/advanced/zabbix/4.0/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/java-gateway/Makefile b/linux/advanced/zabbix/4.0/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/java-gateway/Makefile +++ b/linux/advanced/zabbix/4.0/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/java-gateway/kaniko-build.py b/linux/advanced/zabbix/4.0/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/java-gateway/requirements.txt b/linux/advanced/zabbix/4.0/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/4.0/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/proxy-mysql/Makefile b/linux/advanced/zabbix/4.0/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/4.0/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/4.0/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/proxy-mysql/requirements.txt b/linux/advanced/zabbix/4.0/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/4.0/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/proxy-sqlite3/Makefile b/linux/advanced/zabbix/4.0/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/4.0/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/4.0/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/4.0/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/4.0/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/server-mysql/Makefile b/linux/advanced/zabbix/4.0/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/server-mysql/Makefile +++ b/linux/advanced/zabbix/4.0/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/server-mysql/kaniko-build.py b/linux/advanced/zabbix/4.0/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/server-mysql/requirements.txt b/linux/advanced/zabbix/4.0/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/4.0/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/server-pgsql/Makefile b/linux/advanced/zabbix/4.0/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/server-pgsql/Makefile +++ b/linux/advanced/zabbix/4.0/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/4.0/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/server-pgsql/requirements.txt b/linux/advanced/zabbix/4.0/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/4.0/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/snmptraps/Makefile b/linux/advanced/zabbix/4.0/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/snmptraps/Makefile +++ b/linux/advanced/zabbix/4.0/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/snmptraps/kaniko-build.py b/linux/advanced/zabbix/4.0/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/snmptraps/requirements.txt b/linux/advanced/zabbix/4.0/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/4.0/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/web-mysql/Makefile b/linux/advanced/zabbix/4.0/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/web-mysql/Makefile +++ b/linux/advanced/zabbix/4.0/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/web-mysql/kaniko-build.py b/linux/advanced/zabbix/4.0/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/web-mysql/requirements.txt b/linux/advanced/zabbix/4.0/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/4.0/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/4.0/web-pgsql/Makefile b/linux/advanced/zabbix/4.0/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/4.0/web-pgsql/Makefile +++ b/linux/advanced/zabbix/4.0/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/4.0/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/4.0/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/4.0/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/4.0/web-pgsql/requirements.txt b/linux/advanced/zabbix/4.0/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/4.0/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/4.0/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/agent/Makefile b/linux/advanced/zabbix/5.0/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/agent/Makefile +++ b/linux/advanced/zabbix/5.0/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/agent/kaniko-build.py b/linux/advanced/zabbix/5.0/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/agent/requirements.txt b/linux/advanced/zabbix/5.0/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/agent/requirements.txt +++ b/linux/advanced/zabbix/5.0/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/agent2/Makefile b/linux/advanced/zabbix/5.0/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/agent2/Makefile +++ b/linux/advanced/zabbix/5.0/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/agent2/kaniko-build.py b/linux/advanced/zabbix/5.0/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/agent2/requirements.txt b/linux/advanced/zabbix/5.0/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/agent2/requirements.txt +++ b/linux/advanced/zabbix/5.0/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/java-gateway/Makefile b/linux/advanced/zabbix/5.0/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/java-gateway/Makefile +++ b/linux/advanced/zabbix/5.0/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/java-gateway/kaniko-build.py b/linux/advanced/zabbix/5.0/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/java-gateway/requirements.txt b/linux/advanced/zabbix/5.0/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/5.0/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/proxy-mysql/Makefile b/linux/advanced/zabbix/5.0/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/5.0/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/5.0/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/proxy-mysql/requirements.txt b/linux/advanced/zabbix/5.0/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.0/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/proxy-sqlite3/Makefile b/linux/advanced/zabbix/5.0/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/5.0/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/5.0/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/5.0/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/5.0/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/server-mysql/Makefile b/linux/advanced/zabbix/5.0/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/server-mysql/Makefile +++ b/linux/advanced/zabbix/5.0/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/server-mysql/kaniko-build.py b/linux/advanced/zabbix/5.0/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/server-mysql/requirements.txt b/linux/advanced/zabbix/5.0/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.0/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/server-pgsql/Makefile b/linux/advanced/zabbix/5.0/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/server-pgsql/Makefile +++ b/linux/advanced/zabbix/5.0/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/5.0/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/server-pgsql/requirements.txt b/linux/advanced/zabbix/5.0/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/5.0/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/snmptraps/Makefile b/linux/advanced/zabbix/5.0/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/snmptraps/Makefile +++ b/linux/advanced/zabbix/5.0/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/snmptraps/kaniko-build.py b/linux/advanced/zabbix/5.0/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/snmptraps/requirements.txt b/linux/advanced/zabbix/5.0/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/5.0/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/web-mysql/Makefile b/linux/advanced/zabbix/5.0/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/web-mysql/Makefile +++ b/linux/advanced/zabbix/5.0/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/web-mysql/kaniko-build.py b/linux/advanced/zabbix/5.0/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/web-mysql/requirements.txt b/linux/advanced/zabbix/5.0/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.0/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.0/web-pgsql/Makefile b/linux/advanced/zabbix/5.0/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.0/web-pgsql/Makefile +++ b/linux/advanced/zabbix/5.0/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.0/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/5.0/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.0/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.0/web-pgsql/requirements.txt b/linux/advanced/zabbix/5.0/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.0/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/5.0/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/agent/Makefile b/linux/advanced/zabbix/5.2/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/agent/Makefile +++ b/linux/advanced/zabbix/5.2/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/agent/kaniko-build.py b/linux/advanced/zabbix/5.2/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/agent/requirements.txt b/linux/advanced/zabbix/5.2/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/agent/requirements.txt +++ b/linux/advanced/zabbix/5.2/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/agent2/Makefile b/linux/advanced/zabbix/5.2/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/agent2/Makefile +++ b/linux/advanced/zabbix/5.2/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/agent2/kaniko-build.py b/linux/advanced/zabbix/5.2/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/agent2/requirements.txt b/linux/advanced/zabbix/5.2/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/agent2/requirements.txt +++ b/linux/advanced/zabbix/5.2/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/java-gateway/Makefile b/linux/advanced/zabbix/5.2/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/java-gateway/Makefile +++ b/linux/advanced/zabbix/5.2/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/java-gateway/kaniko-build.py b/linux/advanced/zabbix/5.2/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/java-gateway/requirements.txt b/linux/advanced/zabbix/5.2/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/5.2/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/proxy-mysql/Makefile b/linux/advanced/zabbix/5.2/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/5.2/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/5.2/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/proxy-mysql/requirements.txt b/linux/advanced/zabbix/5.2/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.2/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/proxy-sqlite3/Makefile b/linux/advanced/zabbix/5.2/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/5.2/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/5.2/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/5.2/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/5.2/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/server-mysql/Makefile b/linux/advanced/zabbix/5.2/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/server-mysql/Makefile +++ b/linux/advanced/zabbix/5.2/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/server-mysql/kaniko-build.py b/linux/advanced/zabbix/5.2/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/server-mysql/requirements.txt b/linux/advanced/zabbix/5.2/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.2/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/server-pgsql/Makefile b/linux/advanced/zabbix/5.2/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/server-pgsql/Makefile +++ b/linux/advanced/zabbix/5.2/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/5.2/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/server-pgsql/requirements.txt b/linux/advanced/zabbix/5.2/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/5.2/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/snmptraps/Makefile b/linux/advanced/zabbix/5.2/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/snmptraps/Makefile +++ b/linux/advanced/zabbix/5.2/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/snmptraps/kaniko-build.py b/linux/advanced/zabbix/5.2/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/snmptraps/requirements.txt b/linux/advanced/zabbix/5.2/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/5.2/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/web-mysql/Makefile b/linux/advanced/zabbix/5.2/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/web-mysql/Makefile +++ b/linux/advanced/zabbix/5.2/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/web-mysql/kaniko-build.py b/linux/advanced/zabbix/5.2/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/web-mysql/requirements.txt b/linux/advanced/zabbix/5.2/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.2/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.2/web-pgsql/Makefile b/linux/advanced/zabbix/5.2/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.2/web-pgsql/Makefile +++ b/linux/advanced/zabbix/5.2/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.2/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/5.2/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.2/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.2/web-pgsql/requirements.txt b/linux/advanced/zabbix/5.2/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.2/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/5.2/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/agent/Makefile b/linux/advanced/zabbix/5.4/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/agent/Makefile +++ b/linux/advanced/zabbix/5.4/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/agent/kaniko-build.py b/linux/advanced/zabbix/5.4/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/agent/requirements.txt b/linux/advanced/zabbix/5.4/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/agent/requirements.txt +++ b/linux/advanced/zabbix/5.4/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/agent2/Makefile b/linux/advanced/zabbix/5.4/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/agent2/Makefile +++ b/linux/advanced/zabbix/5.4/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/agent2/kaniko-build.py b/linux/advanced/zabbix/5.4/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/agent2/requirements.txt b/linux/advanced/zabbix/5.4/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/agent2/requirements.txt +++ b/linux/advanced/zabbix/5.4/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/java-gateway/Makefile b/linux/advanced/zabbix/5.4/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/java-gateway/Makefile +++ b/linux/advanced/zabbix/5.4/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/java-gateway/kaniko-build.py b/linux/advanced/zabbix/5.4/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/java-gateway/requirements.txt b/linux/advanced/zabbix/5.4/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/5.4/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/proxy-mysql/Makefile b/linux/advanced/zabbix/5.4/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/5.4/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/5.4/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/proxy-mysql/requirements.txt b/linux/advanced/zabbix/5.4/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.4/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/proxy-sqlite3/Makefile b/linux/advanced/zabbix/5.4/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/5.4/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/5.4/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/5.4/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/5.4/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/server-mysql/Makefile b/linux/advanced/zabbix/5.4/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/server-mysql/Makefile +++ b/linux/advanced/zabbix/5.4/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/server-mysql/kaniko-build.py b/linux/advanced/zabbix/5.4/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/server-mysql/requirements.txt b/linux/advanced/zabbix/5.4/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.4/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/server-pgsql/Makefile b/linux/advanced/zabbix/5.4/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/server-pgsql/Makefile +++ b/linux/advanced/zabbix/5.4/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/5.4/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/server-pgsql/requirements.txt b/linux/advanced/zabbix/5.4/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/5.4/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/snmptraps/Makefile b/linux/advanced/zabbix/5.4/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/snmptraps/Makefile +++ b/linux/advanced/zabbix/5.4/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/snmptraps/kaniko-build.py b/linux/advanced/zabbix/5.4/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/snmptraps/requirements.txt b/linux/advanced/zabbix/5.4/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/5.4/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/web-mysql/Makefile b/linux/advanced/zabbix/5.4/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/web-mysql/Makefile +++ b/linux/advanced/zabbix/5.4/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/web-mysql/kaniko-build.py b/linux/advanced/zabbix/5.4/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/web-mysql/requirements.txt b/linux/advanced/zabbix/5.4/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/5.4/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/5.4/web-pgsql/Makefile b/linux/advanced/zabbix/5.4/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/5.4/web-pgsql/Makefile +++ b/linux/advanced/zabbix/5.4/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/5.4/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/5.4/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/5.4/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/5.4/web-pgsql/requirements.txt b/linux/advanced/zabbix/5.4/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/5.4/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/5.4/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/agent/Makefile b/linux/advanced/zabbix/6.0/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/agent/Makefile +++ b/linux/advanced/zabbix/6.0/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/agent/kaniko-build.py b/linux/advanced/zabbix/6.0/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/agent/requirements.txt b/linux/advanced/zabbix/6.0/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/agent/requirements.txt +++ b/linux/advanced/zabbix/6.0/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/agent2/Makefile b/linux/advanced/zabbix/6.0/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/agent2/Makefile +++ b/linux/advanced/zabbix/6.0/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/agent2/kaniko-build.py b/linux/advanced/zabbix/6.0/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/agent2/requirements.txt b/linux/advanced/zabbix/6.0/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/agent2/requirements.txt +++ b/linux/advanced/zabbix/6.0/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/java-gateway/Makefile b/linux/advanced/zabbix/6.0/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/java-gateway/Makefile +++ b/linux/advanced/zabbix/6.0/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/java-gateway/kaniko-build.py b/linux/advanced/zabbix/6.0/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/java-gateway/requirements.txt b/linux/advanced/zabbix/6.0/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/6.0/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/proxy-mysql/Makefile b/linux/advanced/zabbix/6.0/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/6.0/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/6.0/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/proxy-mysql/requirements.txt b/linux/advanced/zabbix/6.0/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.0/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/proxy-sqlite3/Makefile b/linux/advanced/zabbix/6.0/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/6.0/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/6.0/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/6.0/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/6.0/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/server-mysql/Makefile b/linux/advanced/zabbix/6.0/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/server-mysql/Makefile +++ b/linux/advanced/zabbix/6.0/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/server-mysql/kaniko-build.py b/linux/advanced/zabbix/6.0/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/server-mysql/requirements.txt b/linux/advanced/zabbix/6.0/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.0/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/server-pgsql/Makefile b/linux/advanced/zabbix/6.0/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/server-pgsql/Makefile +++ b/linux/advanced/zabbix/6.0/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/6.0/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/server-pgsql/requirements.txt b/linux/advanced/zabbix/6.0/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/6.0/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/snmptraps/Makefile b/linux/advanced/zabbix/6.0/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/snmptraps/Makefile +++ b/linux/advanced/zabbix/6.0/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/snmptraps/kaniko-build.py b/linux/advanced/zabbix/6.0/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/snmptraps/requirements.txt b/linux/advanced/zabbix/6.0/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/6.0/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/web-mysql/Makefile b/linux/advanced/zabbix/6.0/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/web-mysql/Makefile +++ b/linux/advanced/zabbix/6.0/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/web-mysql/kaniko-build.py b/linux/advanced/zabbix/6.0/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/web-mysql/requirements.txt b/linux/advanced/zabbix/6.0/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.0/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.0/web-pgsql/Makefile b/linux/advanced/zabbix/6.0/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.0/web-pgsql/Makefile +++ b/linux/advanced/zabbix/6.0/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.0/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/6.0/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.0/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.0/web-pgsql/requirements.txt b/linux/advanced/zabbix/6.0/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.0/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/6.0/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/agent/Makefile b/linux/advanced/zabbix/6.2/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/agent/Makefile +++ b/linux/advanced/zabbix/6.2/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/agent/kaniko-build.py b/linux/advanced/zabbix/6.2/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/agent/requirements.txt b/linux/advanced/zabbix/6.2/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/agent/requirements.txt +++ b/linux/advanced/zabbix/6.2/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/agent2/Makefile b/linux/advanced/zabbix/6.2/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/agent2/Makefile +++ b/linux/advanced/zabbix/6.2/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/agent2/kaniko-build.py b/linux/advanced/zabbix/6.2/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/agent2/requirements.txt b/linux/advanced/zabbix/6.2/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/agent2/requirements.txt +++ b/linux/advanced/zabbix/6.2/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/java-gateway/Makefile b/linux/advanced/zabbix/6.2/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/java-gateway/Makefile +++ b/linux/advanced/zabbix/6.2/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/java-gateway/kaniko-build.py b/linux/advanced/zabbix/6.2/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/java-gateway/requirements.txt b/linux/advanced/zabbix/6.2/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/6.2/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/proxy-mysql/Makefile b/linux/advanced/zabbix/6.2/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/6.2/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/6.2/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/proxy-mysql/requirements.txt b/linux/advanced/zabbix/6.2/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.2/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/proxy-sqlite3/Makefile b/linux/advanced/zabbix/6.2/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/6.2/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/6.2/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/6.2/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/6.2/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/server-mysql/Makefile b/linux/advanced/zabbix/6.2/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/server-mysql/Makefile +++ b/linux/advanced/zabbix/6.2/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/server-mysql/kaniko-build.py b/linux/advanced/zabbix/6.2/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/server-mysql/requirements.txt b/linux/advanced/zabbix/6.2/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.2/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/server-pgsql/Makefile b/linux/advanced/zabbix/6.2/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/server-pgsql/Makefile +++ b/linux/advanced/zabbix/6.2/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/6.2/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/server-pgsql/requirements.txt b/linux/advanced/zabbix/6.2/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/6.2/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/snmptraps/Makefile b/linux/advanced/zabbix/6.2/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/snmptraps/Makefile +++ b/linux/advanced/zabbix/6.2/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/snmptraps/kaniko-build.py b/linux/advanced/zabbix/6.2/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/snmptraps/requirements.txt b/linux/advanced/zabbix/6.2/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/6.2/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/web-mysql/Makefile b/linux/advanced/zabbix/6.2/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/web-mysql/Makefile +++ b/linux/advanced/zabbix/6.2/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/web-mysql/kaniko-build.py b/linux/advanced/zabbix/6.2/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/web-mysql/requirements.txt b/linux/advanced/zabbix/6.2/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.2/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.2/web-pgsql/Makefile b/linux/advanced/zabbix/6.2/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.2/web-pgsql/Makefile +++ b/linux/advanced/zabbix/6.2/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.2/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/6.2/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.2/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.2/web-pgsql/requirements.txt b/linux/advanced/zabbix/6.2/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.2/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/6.2/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/agent/Makefile b/linux/advanced/zabbix/6.4/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/agent/Makefile +++ b/linux/advanced/zabbix/6.4/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/agent/kaniko-build.py b/linux/advanced/zabbix/6.4/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/agent/requirements.txt b/linux/advanced/zabbix/6.4/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/agent/requirements.txt +++ b/linux/advanced/zabbix/6.4/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/agent2/Makefile b/linux/advanced/zabbix/6.4/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/agent2/Makefile +++ b/linux/advanced/zabbix/6.4/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/agent2/kaniko-build.py b/linux/advanced/zabbix/6.4/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/agent2/requirements.txt b/linux/advanced/zabbix/6.4/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/agent2/requirements.txt +++ b/linux/advanced/zabbix/6.4/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/java-gateway/Makefile b/linux/advanced/zabbix/6.4/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/java-gateway/Makefile +++ b/linux/advanced/zabbix/6.4/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/java-gateway/kaniko-build.py b/linux/advanced/zabbix/6.4/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/java-gateway/requirements.txt b/linux/advanced/zabbix/6.4/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/6.4/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/proxy-mysql/Makefile b/linux/advanced/zabbix/6.4/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/6.4/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/6.4/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/proxy-mysql/requirements.txt b/linux/advanced/zabbix/6.4/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.4/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/proxy-sqlite3/Makefile b/linux/advanced/zabbix/6.4/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/6.4/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/6.4/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/6.4/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/6.4/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/server-mysql/Makefile b/linux/advanced/zabbix/6.4/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/server-mysql/Makefile +++ b/linux/advanced/zabbix/6.4/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/server-mysql/kaniko-build.py b/linux/advanced/zabbix/6.4/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/server-mysql/requirements.txt b/linux/advanced/zabbix/6.4/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.4/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/server-pgsql/Makefile b/linux/advanced/zabbix/6.4/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/server-pgsql/Makefile +++ b/linux/advanced/zabbix/6.4/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/6.4/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/server-pgsql/requirements.txt b/linux/advanced/zabbix/6.4/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/6.4/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/snmptraps/Makefile b/linux/advanced/zabbix/6.4/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/snmptraps/Makefile +++ b/linux/advanced/zabbix/6.4/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/snmptraps/kaniko-build.py b/linux/advanced/zabbix/6.4/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/snmptraps/requirements.txt b/linux/advanced/zabbix/6.4/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/6.4/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/web-mysql/Makefile b/linux/advanced/zabbix/6.4/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/web-mysql/Makefile +++ b/linux/advanced/zabbix/6.4/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/web-mysql/kaniko-build.py b/linux/advanced/zabbix/6.4/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/web-mysql/requirements.txt b/linux/advanced/zabbix/6.4/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/6.4/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/6.4/web-pgsql/Makefile b/linux/advanced/zabbix/6.4/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/6.4/web-pgsql/Makefile +++ b/linux/advanced/zabbix/6.4/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/6.4/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/6.4/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/6.4/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/6.4/web-pgsql/requirements.txt b/linux/advanced/zabbix/6.4/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/6.4/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/6.4/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/agent/Makefile b/linux/advanced/zabbix/latest/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/agent/Makefile +++ b/linux/advanced/zabbix/latest/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/agent/kaniko-build.py b/linux/advanced/zabbix/latest/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/agent/requirements.txt b/linux/advanced/zabbix/latest/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/agent/requirements.txt +++ b/linux/advanced/zabbix/latest/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/agent2/Makefile b/linux/advanced/zabbix/latest/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/agent2/Makefile +++ b/linux/advanced/zabbix/latest/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/agent2/kaniko-build.py b/linux/advanced/zabbix/latest/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/agent2/requirements.txt b/linux/advanced/zabbix/latest/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/agent2/requirements.txt +++ b/linux/advanced/zabbix/latest/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/java-gateway/Makefile b/linux/advanced/zabbix/latest/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/java-gateway/Makefile +++ b/linux/advanced/zabbix/latest/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/java-gateway/kaniko-build.py b/linux/advanced/zabbix/latest/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/java-gateway/requirements.txt b/linux/advanced/zabbix/latest/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/latest/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/proxy-mysql/Makefile b/linux/advanced/zabbix/latest/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/latest/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/latest/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/proxy-mysql/requirements.txt b/linux/advanced/zabbix/latest/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/latest/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/proxy-sqlite3/Makefile b/linux/advanced/zabbix/latest/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/latest/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/latest/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/latest/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/latest/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/server-mysql/Makefile b/linux/advanced/zabbix/latest/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/server-mysql/Makefile +++ b/linux/advanced/zabbix/latest/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/server-mysql/kaniko-build.py b/linux/advanced/zabbix/latest/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/server-mysql/requirements.txt b/linux/advanced/zabbix/latest/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/latest/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/server-pgsql/Makefile b/linux/advanced/zabbix/latest/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/server-pgsql/Makefile +++ b/linux/advanced/zabbix/latest/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/latest/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/server-pgsql/requirements.txt b/linux/advanced/zabbix/latest/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/latest/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/snmptraps/Makefile b/linux/advanced/zabbix/latest/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/snmptraps/Makefile +++ b/linux/advanced/zabbix/latest/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/snmptraps/kaniko-build.py b/linux/advanced/zabbix/latest/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/snmptraps/requirements.txt b/linux/advanced/zabbix/latest/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/latest/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/web-mysql/Makefile b/linux/advanced/zabbix/latest/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/web-mysql/Makefile +++ b/linux/advanced/zabbix/latest/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/web-mysql/kaniko-build.py b/linux/advanced/zabbix/latest/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/web-mysql/requirements.txt b/linux/advanced/zabbix/latest/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/latest/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/latest/web-pgsql/Makefile b/linux/advanced/zabbix/latest/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/latest/web-pgsql/Makefile +++ b/linux/advanced/zabbix/latest/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/latest/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/latest/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/latest/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/latest/web-pgsql/requirements.txt b/linux/advanced/zabbix/latest/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/latest/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/latest/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/agent/Makefile b/linux/advanced/zabbix/trunk/agent/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/agent/Makefile +++ b/linux/advanced/zabbix/trunk/agent/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/agent/kaniko-build.py b/linux/advanced/zabbix/trunk/agent/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/agent/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/agent/requirements.txt b/linux/advanced/zabbix/trunk/agent/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/agent/requirements.txt +++ b/linux/advanced/zabbix/trunk/agent/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/agent2/Makefile b/linux/advanced/zabbix/trunk/agent2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/agent2/Makefile +++ b/linux/advanced/zabbix/trunk/agent2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/agent2/kaniko-build.py b/linux/advanced/zabbix/trunk/agent2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/agent2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/agent2/requirements.txt b/linux/advanced/zabbix/trunk/agent2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/agent2/requirements.txt +++ b/linux/advanced/zabbix/trunk/agent2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/java-gateway/Makefile b/linux/advanced/zabbix/trunk/java-gateway/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/java-gateway/Makefile +++ b/linux/advanced/zabbix/trunk/java-gateway/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/java-gateway/kaniko-build.py b/linux/advanced/zabbix/trunk/java-gateway/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/java-gateway/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/java-gateway/requirements.txt b/linux/advanced/zabbix/trunk/java-gateway/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/java-gateway/requirements.txt +++ b/linux/advanced/zabbix/trunk/java-gateway/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/proxy-mysql/Makefile b/linux/advanced/zabbix/trunk/proxy-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/proxy-mysql/Makefile +++ b/linux/advanced/zabbix/trunk/proxy-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/proxy-mysql/kaniko-build.py b/linux/advanced/zabbix/trunk/proxy-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/proxy-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/proxy-mysql/requirements.txt b/linux/advanced/zabbix/trunk/proxy-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/proxy-mysql/requirements.txt +++ b/linux/advanced/zabbix/trunk/proxy-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/proxy-sqlite3/Makefile b/linux/advanced/zabbix/trunk/proxy-sqlite3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/proxy-sqlite3/Makefile +++ b/linux/advanced/zabbix/trunk/proxy-sqlite3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/proxy-sqlite3/kaniko-build.py b/linux/advanced/zabbix/trunk/proxy-sqlite3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/proxy-sqlite3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/proxy-sqlite3/requirements.txt b/linux/advanced/zabbix/trunk/proxy-sqlite3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/proxy-sqlite3/requirements.txt +++ b/linux/advanced/zabbix/trunk/proxy-sqlite3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/server-mysql/Makefile b/linux/advanced/zabbix/trunk/server-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/server-mysql/Makefile +++ b/linux/advanced/zabbix/trunk/server-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/server-mysql/kaniko-build.py b/linux/advanced/zabbix/trunk/server-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/server-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/server-mysql/requirements.txt b/linux/advanced/zabbix/trunk/server-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/server-mysql/requirements.txt +++ b/linux/advanced/zabbix/trunk/server-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/server-pgsql/Makefile b/linux/advanced/zabbix/trunk/server-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/server-pgsql/Makefile +++ b/linux/advanced/zabbix/trunk/server-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/server-pgsql/kaniko-build.py b/linux/advanced/zabbix/trunk/server-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/server-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/server-pgsql/requirements.txt b/linux/advanced/zabbix/trunk/server-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/server-pgsql/requirements.txt +++ b/linux/advanced/zabbix/trunk/server-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/snmptraps/Makefile b/linux/advanced/zabbix/trunk/snmptraps/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/snmptraps/Makefile +++ b/linux/advanced/zabbix/trunk/snmptraps/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/snmptraps/kaniko-build.py b/linux/advanced/zabbix/trunk/snmptraps/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/snmptraps/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/snmptraps/requirements.txt b/linux/advanced/zabbix/trunk/snmptraps/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/snmptraps/requirements.txt +++ b/linux/advanced/zabbix/trunk/snmptraps/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/web-mysql/Makefile b/linux/advanced/zabbix/trunk/web-mysql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/web-mysql/Makefile +++ b/linux/advanced/zabbix/trunk/web-mysql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/web-mysql/kaniko-build.py b/linux/advanced/zabbix/trunk/web-mysql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/web-mysql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/web-mysql/requirements.txt b/linux/advanced/zabbix/trunk/web-mysql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/web-mysql/requirements.txt +++ b/linux/advanced/zabbix/trunk/web-mysql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/advanced/zabbix/trunk/web-pgsql/Makefile b/linux/advanced/zabbix/trunk/web-pgsql/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/advanced/zabbix/trunk/web-pgsql/Makefile +++ b/linux/advanced/zabbix/trunk/web-pgsql/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/advanced/zabbix/trunk/web-pgsql/kaniko-build.py b/linux/advanced/zabbix/trunk/web-pgsql/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/advanced/zabbix/trunk/web-pgsql/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/advanced/zabbix/trunk/web-pgsql/requirements.txt b/linux/advanced/zabbix/trunk/web-pgsql/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/advanced/zabbix/trunk/web-pgsql/requirements.txt +++ b/linux/advanced/zabbix/trunk/web-pgsql/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk11/Makefile b/linux/discontinued/ecosystem/epicmorg/devel/jdk11/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk11/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk11/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/devel/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk11/requirements.txt b/linux/discontinued/ecosystem/epicmorg/devel/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk11/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk16/Makefile b/linux/discontinued/ecosystem/epicmorg/devel/jdk16/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk16/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk16/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/devel/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk16/requirements.txt b/linux/discontinued/ecosystem/epicmorg/devel/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk16/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk6/Makefile b/linux/discontinued/ecosystem/epicmorg/devel/jdk6/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk6/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk6/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/devel/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk6/requirements.txt b/linux/discontinued/ecosystem/epicmorg/devel/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk6/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk7/Makefile b/linux/discontinued/ecosystem/epicmorg/devel/jdk7/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk7/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk7/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/devel/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk7/requirements.txt b/linux/discontinued/ecosystem/epicmorg/devel/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk7/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk8/Makefile b/linux/discontinued/ecosystem/epicmorg/devel/jdk8/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk8/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk8/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/devel/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/devel/jdk8/requirements.txt b/linux/discontinued/ecosystem/epicmorg/devel/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/jdk8/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/devel/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/devel/main/Makefile b/linux/discontinued/ecosystem/epicmorg/devel/main/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/main/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/devel/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/devel/main/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/devel/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/devel/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/devel/main/requirements.txt b/linux/discontinued/ecosystem/epicmorg/devel/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/devel/main/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/devel/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk11/Makefile b/linux/discontinued/ecosystem/epicmorg/edge/jdk11/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk11/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk11/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/edge/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk11/requirements.txt b/linux/discontinued/ecosystem/epicmorg/edge/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk11/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk16/Makefile b/linux/discontinued/ecosystem/epicmorg/edge/jdk16/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk16/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk16/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/edge/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk16/requirements.txt b/linux/discontinued/ecosystem/epicmorg/edge/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk16/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk6/Makefile b/linux/discontinued/ecosystem/epicmorg/edge/jdk6/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk6/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk6/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/edge/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk6/requirements.txt b/linux/discontinued/ecosystem/epicmorg/edge/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk6/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk7/Makefile b/linux/discontinued/ecosystem/epicmorg/edge/jdk7/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk7/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk7/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/edge/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk7/requirements.txt b/linux/discontinued/ecosystem/epicmorg/edge/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk7/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk8/Makefile b/linux/discontinued/ecosystem/epicmorg/edge/jdk8/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk8/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk8/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/edge/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/edge/jdk8/requirements.txt b/linux/discontinued/ecosystem/epicmorg/edge/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/jdk8/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/edge/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/edge/main/Makefile b/linux/discontinued/ecosystem/epicmorg/edge/main/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/main/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/edge/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/edge/main/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/edge/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/edge/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/edge/main/requirements.txt b/linux/discontinued/ecosystem/epicmorg/edge/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/edge/main/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/edge/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk11/Makefile b/linux/discontinued/ecosystem/epicmorg/prod/jdk11/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk11/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk11/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/prod/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk11/requirements.txt b/linux/discontinued/ecosystem/epicmorg/prod/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk11/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk16/Makefile b/linux/discontinued/ecosystem/epicmorg/prod/jdk16/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk16/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk16/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/prod/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk16/requirements.txt b/linux/discontinued/ecosystem/epicmorg/prod/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk16/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk6/Makefile b/linux/discontinued/ecosystem/epicmorg/prod/jdk6/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk6/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk6/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/prod/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk6/requirements.txt b/linux/discontinued/ecosystem/epicmorg/prod/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk6/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk7/Makefile b/linux/discontinued/ecosystem/epicmorg/prod/jdk7/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk7/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk7/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/prod/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk7/requirements.txt b/linux/discontinued/ecosystem/epicmorg/prod/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk7/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk8/Makefile b/linux/discontinued/ecosystem/epicmorg/prod/jdk8/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk8/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk8/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/prod/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/prod/jdk8/requirements.txt b/linux/discontinued/ecosystem/epicmorg/prod/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/jdk8/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/prod/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/epicmorg/prod/main/Makefile b/linux/discontinued/ecosystem/epicmorg/prod/main/Makefile index 3675f4fa8..0adfe5b54 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/main/Makefile +++ b/linux/discontinued/ecosystem/epicmorg/prod/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/epicmorg/prod/main/kaniko-build.py b/linux/discontinued/ecosystem/epicmorg/prod/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/epicmorg/prod/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/epicmorg/prod/main/requirements.txt b/linux/discontinued/ecosystem/epicmorg/prod/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/epicmorg/prod/main/requirements.txt +++ b/linux/discontinued/ecosystem/epicmorg/prod/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.0/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.0/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.0/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.0/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.0/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.1/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.1/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.1/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.1/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.1/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.2/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.2/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.2/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.2/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.2/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3.1/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3.1/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3.1/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3.1/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3.1/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3.2/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3.2/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3.2/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3.2/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3.2/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.3/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.3/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.4/Makefile b/linux/discontinued/ecosystem/freegpt-webui/1.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.4/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/1.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.4/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/1.4/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/1.4/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/freegpt-webui/latest/Makefile b/linux/discontinued/ecosystem/freegpt-webui/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/latest/Makefile +++ b/linux/discontinued/ecosystem/freegpt-webui/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/discontinued/ecosystem/freegpt-webui/latest/kaniko-build.py b/linux/discontinued/ecosystem/freegpt-webui/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/freegpt-webui/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/freegpt-webui/latest/requirements.txt b/linux/discontinued/ecosystem/freegpt-webui/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/freegpt-webui/latest/requirements.txt +++ b/linux/discontinued/ecosystem/freegpt-webui/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/discontinued/ecosystem/syspass/sysPass/kaniko-build.py b/linux/discontinued/ecosystem/syspass/sysPass/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/discontinued/ecosystem/syspass/sysPass/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/discontinued/ecosystem/syspass/sysPass/requirements.txt b/linux/discontinued/ecosystem/syspass/sysPass/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/discontinued/ecosystem/syspass/sysPass/requirements.txt +++ b/linux/discontinued/ecosystem/syspass/sysPass/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php5.5/Makefile b/linux/ecosystem/apache2/php5.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php5.5/Makefile +++ b/linux/ecosystem/apache2/php5.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php5.5/kaniko-build.py b/linux/ecosystem/apache2/php5.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php5.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php5.5/requirements.txt b/linux/ecosystem/apache2/php5.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php5.5/requirements.txt +++ b/linux/ecosystem/apache2/php5.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php7.0/Makefile b/linux/ecosystem/apache2/php7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php7.0/Makefile +++ b/linux/ecosystem/apache2/php7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php7.0/kaniko-build.py b/linux/ecosystem/apache2/php7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php7.0/requirements.txt b/linux/ecosystem/apache2/php7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php7.0/requirements.txt +++ b/linux/ecosystem/apache2/php7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php7.1/Makefile b/linux/ecosystem/apache2/php7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php7.1/Makefile +++ b/linux/ecosystem/apache2/php7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php7.1/kaniko-build.py b/linux/ecosystem/apache2/php7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php7.1/requirements.txt b/linux/ecosystem/apache2/php7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php7.1/requirements.txt +++ b/linux/ecosystem/apache2/php7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php7.2/Makefile b/linux/ecosystem/apache2/php7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php7.2/Makefile +++ b/linux/ecosystem/apache2/php7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php7.2/kaniko-build.py b/linux/ecosystem/apache2/php7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php7.2/requirements.txt b/linux/ecosystem/apache2/php7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php7.2/requirements.txt +++ b/linux/ecosystem/apache2/php7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php7.3/Makefile b/linux/ecosystem/apache2/php7.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php7.3/Makefile +++ b/linux/ecosystem/apache2/php7.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php7.3/kaniko-build.py b/linux/ecosystem/apache2/php7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php7.3/requirements.txt b/linux/ecosystem/apache2/php7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php7.3/requirements.txt +++ b/linux/ecosystem/apache2/php7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php7.4/Makefile b/linux/ecosystem/apache2/php7.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php7.4/Makefile +++ b/linux/ecosystem/apache2/php7.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php7.4/kaniko-build.py b/linux/ecosystem/apache2/php7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php7.4/requirements.txt b/linux/ecosystem/apache2/php7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php7.4/requirements.txt +++ b/linux/ecosystem/apache2/php7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php8.0/Makefile b/linux/ecosystem/apache2/php8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php8.0/Makefile +++ b/linux/ecosystem/apache2/php8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php8.0/kaniko-build.py b/linux/ecosystem/apache2/php8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php8.0/requirements.txt b/linux/ecosystem/apache2/php8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php8.0/requirements.txt +++ b/linux/ecosystem/apache2/php8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php8.1/Makefile b/linux/ecosystem/apache2/php8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php8.1/Makefile +++ b/linux/ecosystem/apache2/php8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php8.1/kaniko-build.py b/linux/ecosystem/apache2/php8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php8.1/requirements.txt b/linux/ecosystem/apache2/php8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php8.1/requirements.txt +++ b/linux/ecosystem/apache2/php8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php8.2/Makefile b/linux/ecosystem/apache2/php8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php8.2/Makefile +++ b/linux/ecosystem/apache2/php8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php8.2/kaniko-build.py b/linux/ecosystem/apache2/php8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php8.2/requirements.txt b/linux/ecosystem/apache2/php8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php8.2/requirements.txt +++ b/linux/ecosystem/apache2/php8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/apache2/php8.3/Makefile b/linux/ecosystem/apache2/php8.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/apache2/php8.3/Makefile +++ b/linux/ecosystem/apache2/php8.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/apache2/php8.3/kaniko-build.py b/linux/ecosystem/apache2/php8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/apache2/php8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/apache2/php8.3/requirements.txt b/linux/ecosystem/apache2/php8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/apache2/php8.3/requirements.txt +++ b/linux/ecosystem/apache2/php8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.0.3/Makefile b/linux/ecosystem/atlassian/bitbucket/1/1.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.0.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/1/1.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.0.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/1/1.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/1/1.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.0.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/1/1.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/1/1.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.1.2/Makefile b/linux/ecosystem/atlassian/bitbucket/1/1.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.1.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/1/1.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.1.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/1/1.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/1/1.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.1.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/1/1.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/1/1.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.2.1/Makefile b/linux/ecosystem/atlassian/bitbucket/1/1.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.2.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/1/1.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.2.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/1/1.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/1/1.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.2.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/1/1.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/1/1.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.2.4/Makefile b/linux/ecosystem/atlassian/bitbucket/1/1.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.2.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/1/1.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.2.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/1/1.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/1/1.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.2.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/1/1.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/1/1.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.3.1/Makefile b/linux/ecosystem/atlassian/bitbucket/1/1.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.3.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/1/1.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.3.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/1/1.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/1/1.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/1/1.3.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/1/1.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/1/1.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/1/1.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.0.3/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.0.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.0.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.0.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.1.2/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.1.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.1.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.1.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.0/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.10.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.1/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.10.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.2/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.10.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.3/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.10.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.10.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.10.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.4/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.10.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.10.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.10.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.5/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.10.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.10.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.10.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.10.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.10.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.10.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.3/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.4/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.5/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.6/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.7/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.7/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.7/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.7/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.7/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.8/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.8/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.8/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.8/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.8/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.9/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.11.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.9/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.9/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.11.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.11.9/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.11.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.11.9/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.11.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.0/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.1/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.2/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.3/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.4/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.5/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.6/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.12.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.12.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.12.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.12.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.12.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.12.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.2.0/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.2.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.2.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.2.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.3.1/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.3.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.3.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.3.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.4.2/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.4.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.4.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.4.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.5.4/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.5.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.5.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.5.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.5.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.5.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.6.5/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.6.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.6.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.6.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.6.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.6.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.6.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.6.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.6.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.6.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.6.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.7.6/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.7.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.7.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.7.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.7.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.7.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.7.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.7.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.7.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.7.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.7.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.8.4/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.8.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.8.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.8.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.8.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.8.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.8.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.8.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.8.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.8.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.8.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.8.5/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.8.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.8.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.8.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.8.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.8.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.8.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.8.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.8.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.8.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.8.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.1/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.9.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.2/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.9.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.3/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.9.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.9.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.9.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.4/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.9.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.9.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.9.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.5/Makefile b/linux/ecosystem/atlassian/bitbucket/2/2.9.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/2/2.9.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/2/2.9.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/2/2.9.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/2/2.9.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/2/2.9.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.0.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.4/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.0.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.5/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.0.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.0.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.0.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.6/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.0.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.0.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.0.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.7/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.0.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.7/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.7/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.0.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.7/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.0.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.7/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.8/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.0.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.8/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.8/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.0.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.0.8/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.0.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.0.8/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.0.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.3/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.4/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.1.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.5/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.1.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.1.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.1.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.7/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.1.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.7/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.7/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.1.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.1.7/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.1.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.1.7/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.1.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.10.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.2/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.10.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.3/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.10.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.10.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.10.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.4/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.10.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.10.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.10.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.10.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.10.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.10.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.11.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.11.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.11.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.11.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.11.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.11.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.2/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.11.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.11.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.11.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.3/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.11.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.11.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.11.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.4/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.11.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.11.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.11.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.6/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.11.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.11.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.11.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.11.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.11.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.11.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.2/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.4/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.5/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.2.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.2.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.2.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.7/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.2.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.7/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.7/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.2.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.2.7/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.2.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.2.7/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.2.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.3.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.2/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.3/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.5/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.3.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.3.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.3.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.3.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.3.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.3.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.3/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.5/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.4.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.4.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.5.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.5.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.5.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.5.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.5.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.5.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.5.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.5.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.5.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.5.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.6.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.6.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.6.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.6.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.6.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.6.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.6.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.6.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.2/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.3/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.7.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.4/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.7.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.7.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.7.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.8.0/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.8.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.8.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.8.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.8.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.8.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.8.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.8.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.9.1/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.9.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.9.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.9.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.9.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.9.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.9.2/Makefile b/linux/ecosystem/atlassian/bitbucket/3/3.9.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.9.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/3/3.9.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.9.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/3/3.9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/3/3.9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/3/3.9.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/3/3.9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/3/3.9.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/3/3.9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.4/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.6/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.7/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.7/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.7/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.7/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.7/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.8/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.0.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.8/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.8/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.0.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.0.8/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.0.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.0.8/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.0.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.4/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.1.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.6/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.1.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.1.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.1.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.1.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.1.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.1.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.10.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.10.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.10.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.10.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.10.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.10.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.10.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.11.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.11.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.11.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.11.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.11.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.11.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.11.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.11.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.11.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.11.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.11.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.11.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.11.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.11.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.11.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.11.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.11.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.11.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.11.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.11.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.11.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.11.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.12.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.12.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.12.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.12.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.12.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.12.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.12.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.12.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.12.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.12.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.12.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.12.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.12.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.12.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.12.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.12.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.12.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.13.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.13.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.13.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.13.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.13.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.13.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.13.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.13.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.13.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.13.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.13.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.13.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.13.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.13.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.13.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.13.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.13.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.13.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.13.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.13.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.13.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.13.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.10/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.10/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.10/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.10/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.10/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.11/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.11/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.11/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.11/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.11/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.12/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.12/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.12/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.12/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.12/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.4/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.5/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.6/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.7/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.7/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.7/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.7/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.7/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.8/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.8/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.8/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.8/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.8/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.9/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.14.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.9/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.9/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.14.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.14.9/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.14.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.14.9/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.14.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.2.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.2.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.3.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.3.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.4/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.4.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.4.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.5.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.5.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.5.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.5.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.5.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.6.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.6.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.4/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.6.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.6.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.7.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.7.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.7.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.7.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.7.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.7.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.7.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.7.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.2/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.3/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.4/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.5/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.5/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.5/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.5/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.5/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.6/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.8.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.8.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.8.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.8.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.8.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.8.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.9.0/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.9.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.9.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.9.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.9.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.9.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.9.1/Makefile b/linux/ecosystem/atlassian/bitbucket/4/4.9.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.9.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/4/4.9.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.9.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/4/4.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/4/4.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/4/4.9.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/4/4.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/4/4.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/4/4.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/7/7.21.4/Makefile b/linux/ecosystem/atlassian/bitbucket/7/7.21.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/7/7.21.4/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/7/7.21.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/7/7.21.4/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/7/7.21.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/7/7.21.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/7/7.21.4/requirements.txt b/linux/ecosystem/atlassian/bitbucket/7/7.21.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/7/7.21.4/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/7/7.21.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.0.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.0.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.0.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.0.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.0.3/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.0.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.0.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.0.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.1.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.1.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.1.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.1.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.1.3/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.1.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.1.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.1.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.12.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.12.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.12.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.12.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.12.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.12.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.17.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.17.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.17.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.17.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.17.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.17.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.17.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.17.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.17.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.17.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.17.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.19.6/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.19.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.19.6/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.19.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.19.6/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.19.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.19.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.19.6/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.19.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.19.6/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.19.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.2.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.2.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.2.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.2.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.2.2/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.2.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.2.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.2.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.3.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.1/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.2/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.3/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.3/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.3/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.3.3/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.1/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.2/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.2/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.2/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.4.2/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.5.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.5.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.5.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.5.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.5.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.5.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.5.1/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.5.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.5.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.5.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.6.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.6.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.6.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.6.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.6.1/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.6.1/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.6.1/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.6.1/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.7.0/Makefile b/linux/ecosystem/atlassian/bitbucket/8/8.7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.7.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/8/8.7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.7.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/8/8.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/8/8.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/8/8.7.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/8/8.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/8/8.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/8/8.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/9/9.0.0/Makefile b/linux/ecosystem/atlassian/bitbucket/9/9.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/9/9.0.0/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/9/9.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/9/9.0.0/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/9/9.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/9/9.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/9/9.0.0/requirements.txt b/linux/ecosystem/atlassian/bitbucket/9/9.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/9/9.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/9/9.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/bitbucket/latest/Makefile b/linux/ecosystem/atlassian/bitbucket/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/bitbucket/latest/Makefile +++ b/linux/ecosystem/atlassian/bitbucket/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/bitbucket/latest/kaniko-build.py b/linux/ecosystem/atlassian/bitbucket/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/bitbucket/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/bitbucket/latest/requirements.txt b/linux/ecosystem/atlassian/bitbucket/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/bitbucket/latest/requirements.txt +++ b/linux/ecosystem/atlassian/bitbucket/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.5/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.5/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.5/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.6/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.6/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.6/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.7/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.0.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.0.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.0.7/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.0.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.0.7/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.0.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.1.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.10.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.10.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.10.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.10.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.10.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.10.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.11.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.11.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.11.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.11.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.11.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.11.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.11.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.11.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.11.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.11.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.11.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.11.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.11.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.11.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.11.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.11.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.11.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.11.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.11.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.11.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.11.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.12.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.12.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.12.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.12.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.12.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.12.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.12.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.12.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.12.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.12.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.12.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.12.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.12.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.12.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.12.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.12.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.12.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.12.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.12.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.12.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.12.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.10/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.10/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.10/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.11/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.11/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.11/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.12/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.12/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.12/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.13/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.13/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.13/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.15/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.15/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.15/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.17/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.17/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.17/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.18/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.18/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.18/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.19/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.19/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.19/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.20/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.20/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.20/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.21/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.21/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.21/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.5/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.5/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.5/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.6/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.6/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.6/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.7/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.7/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.7/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.8/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.8/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.8/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.9/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.13.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.13.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.13.9/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.13.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.13.9/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.13.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.14.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.14.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.14.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.14.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.14.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.14.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.14.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.14.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.14.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.14.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.14.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.14.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.14.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.14.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.14.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.14.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.14.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.14.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.14.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.14.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.14.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.10/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.10/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.10/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.6/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.6/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.6/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.7/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.7/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.7/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.8/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.8/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.8/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.9/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.15.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.15.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.15.9/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.15.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.15.9/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.15.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.2.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.3.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.4.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.5.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.10/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.10/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.10/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.11/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.11/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.11/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.12/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.12/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.12/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.13/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.13/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.13/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.14/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.14/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.14/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.15/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.15/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.15/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.16/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.16/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.16/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.17/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.17/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.17/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.4/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.5/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.5/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.5/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.6/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.6/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.6/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.7/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.7/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.7/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.8/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.8/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.8/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.9/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.6.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.6.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.6.9/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.6.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.6.9/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.6.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.7.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.7.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.2/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.8.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.8.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.5/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.8.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.8.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.8.5/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.8.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.8.5/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.8.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.9.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.9.0/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.9.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.9.1/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/6/6.9.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/6/6.9.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/6/6.9.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/6/6.9.3/requirements.txt b/linux/ecosystem/atlassian/confluence/6/6.9.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/6/6.9.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/6/6.9.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.0/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.0/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.0/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.1/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.1/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.1/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.16/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.16/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.16/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.16/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.16/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.17/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.17/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.17/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.17/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.17/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.18/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.18/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.18/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.18/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.18/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.2/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.2/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.2/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.3/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.3/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.3/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.4/Makefile b/linux/ecosystem/atlassian/confluence/7/7.19.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.4/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.19.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.4/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.19.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.19.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.19.4/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.19.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.19.4/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.19.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.0/Makefile b/linux/ecosystem/atlassian/confluence/7/7.20.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.0/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.20.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.20.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.20.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.0/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.20.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.20.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.1/Makefile b/linux/ecosystem/atlassian/confluence/7/7.20.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.1/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.20.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.20.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.20.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.1/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.20.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.20.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.2/Makefile b/linux/ecosystem/atlassian/confluence/7/7.20.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.2/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.20.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.20.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.20.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.2/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.20.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.20.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.3/Makefile b/linux/ecosystem/atlassian/confluence/7/7.20.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.3/Makefile +++ b/linux/ecosystem/atlassian/confluence/7/7.20.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/7/7.20.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/7/7.20.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/7/7.20.3/requirements.txt b/linux/ecosystem/atlassian/confluence/7/7.20.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/7/7.20.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/7/7.20.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.0/Makefile b/linux/ecosystem/atlassian/confluence/8/8.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.0.0/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.0/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.1/Makefile b/linux/ecosystem/atlassian/confluence/8/8.0.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.0.1/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.0.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.1/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.2/Makefile b/linux/ecosystem/atlassian/confluence/8/8.0.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.0.2/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.0.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.0.2/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.4.0/Makefile b/linux/ecosystem/atlassian/confluence/8/8.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.4.0/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.4.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.4.0/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.5.3/Makefile b/linux/ecosystem/atlassian/confluence/8/8.5.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.5.3/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.5.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.5.3/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.5.3/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.6.1/Makefile b/linux/ecosystem/atlassian/confluence/8/8.6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.6.1/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.6.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.6.1/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.7.2/Makefile b/linux/ecosystem/atlassian/confluence/8/8.7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.7.2/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.7.2/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.7.2/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.8.1/Makefile b/linux/ecosystem/atlassian/confluence/8/8.8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.8.1/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.8.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.8.1/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/8/8.9.5/Makefile b/linux/ecosystem/atlassian/confluence/8/8.9.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.9.5/Makefile +++ b/linux/ecosystem/atlassian/confluence/8/8.9.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/8/8.9.5/kaniko-build.py b/linux/ecosystem/atlassian/confluence/8/8.9.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/8/8.9.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/8/8.9.5/requirements.txt b/linux/ecosystem/atlassian/confluence/8/8.9.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/8/8.9.5/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/8/8.9.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/9/9.0.0/Makefile b/linux/ecosystem/atlassian/confluence/9/9.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/9/9.0.0/Makefile +++ b/linux/ecosystem/atlassian/confluence/9/9.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/9/9.0.0/kaniko-build.py b/linux/ecosystem/atlassian/confluence/9/9.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/9/9.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/9/9.0.0/requirements.txt b/linux/ecosystem/atlassian/confluence/9/9.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/9/9.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/9/9.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/9/9.0.1/Makefile b/linux/ecosystem/atlassian/confluence/9/9.0.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/9/9.0.1/Makefile +++ b/linux/ecosystem/atlassian/confluence/9/9.0.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/9/9.0.1/kaniko-build.py b/linux/ecosystem/atlassian/confluence/9/9.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/9/9.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/9/9.0.1/requirements.txt b/linux/ecosystem/atlassian/confluence/9/9.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/9/9.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/9/9.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/latest/Makefile b/linux/ecosystem/atlassian/confluence/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/latest/Makefile +++ b/linux/ecosystem/atlassian/confluence/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/latest/kaniko-build.py b/linux/ecosystem/atlassian/confluence/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/latest/requirements.txt b/linux/ecosystem/atlassian/confluence/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/latest/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/templates/5/Makefile b/linux/ecosystem/atlassian/confluence/templates/5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/templates/5/Makefile +++ b/linux/ecosystem/atlassian/confluence/templates/5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/templates/5/kaniko-build.py b/linux/ecosystem/atlassian/confluence/templates/5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/templates/5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/templates/5/requirements.txt b/linux/ecosystem/atlassian/confluence/templates/5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/templates/5/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/templates/5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/confluence/templates/6/Makefile b/linux/ecosystem/atlassian/confluence/templates/6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/confluence/templates/6/Makefile +++ b/linux/ecosystem/atlassian/confluence/templates/6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/confluence/templates/6/kaniko-build.py b/linux/ecosystem/atlassian/confluence/templates/6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/confluence/templates/6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/confluence/templates/6/requirements.txt b/linux/ecosystem/atlassian/confluence/templates/6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/confluence/templates/6/requirements.txt +++ b/linux/ecosystem/atlassian/confluence/templates/6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crowd/5/5.1.1/Makefile b/linux/ecosystem/atlassian/crowd/5/5.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/crowd/5/5.1.1/Makefile +++ b/linux/ecosystem/atlassian/crowd/5/5.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/crowd/5/5.1.1/kaniko-build.py b/linux/ecosystem/atlassian/crowd/5/5.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crowd/5/5.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crowd/5/5.1.1/requirements.txt b/linux/ecosystem/atlassian/crowd/5/5.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crowd/5/5.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/crowd/5/5.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crowd/latest/Makefile b/linux/ecosystem/atlassian/crowd/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/crowd/latest/Makefile +++ b/linux/ecosystem/atlassian/crowd/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/crowd/latest/kaniko-build.py b/linux/ecosystem/atlassian/crowd/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crowd/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crowd/latest/requirements.txt b/linux/ecosystem/atlassian/crowd/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crowd/latest/requirements.txt +++ b/linux/ecosystem/atlassian/crowd/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.0.3/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.0.3/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.0.4/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.0.4/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.0/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.0/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.0/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.2/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.2/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.3/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.3/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.4/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.1.4/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.2.1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.2.1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.2.2/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.2.2/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.2.3/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.2.3/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.2/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.2/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.2/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.2/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.2/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.3/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.3/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.4/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.5.4/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.5/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.5/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.5/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.0/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.0/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.0Beta1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.0Beta2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.2.1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.2.1/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.2/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.2/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.2/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.3/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.3/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.4/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.4/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.5.a/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.5.a/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.5.a/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.5.a/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.5.a/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.5.a/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.5.a/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.5/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.5/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.5/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.5a/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.5a/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.5a/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.5a/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.5a/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.5a/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.5a/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.6/kaniko-build.py b/linux/ecosystem/atlassian/crucible/1/1.6.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/1/1.6.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/1/1.6.6/requirements.txt b/linux/ecosystem/atlassian/crucible/1/1.6.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/1/1.6.6/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/1/1.6.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/crucible/templates/1/Makefile b/linux/ecosystem/atlassian/crucible/templates/1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/crucible/templates/1/Makefile +++ b/linux/ecosystem/atlassian/crucible/templates/1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/crucible/templates/1/kaniko-build.py b/linux/ecosystem/atlassian/crucible/templates/1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/crucible/templates/1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/crucible/templates/1/requirements.txt b/linux/ecosystem/atlassian/crucible/templates/1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/crucible/templates/1/requirements.txt +++ b/linux/ecosystem/atlassian/crucible/templates/1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.B3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0.RC3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.0.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.M2cc/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0.RC1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.10.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.3.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.4.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.5.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.6.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0-EAP-2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.7.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0-m1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/2/2.9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.1.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.10.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.2.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.4.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.5.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/3/3.9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.4.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/4/4.8.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/latest/Makefile b/linux/ecosystem/atlassian/fisheye-crucible/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/latest/Makefile +++ b/linux/ecosystem/atlassian/fisheye-crucible/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/fisheye-crucible/latest/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/latest/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/latest/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/2/Makefile b/linux/ecosystem/atlassian/fisheye-crucible/templates/2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/2/Makefile +++ b/linux/ecosystem/atlassian/fisheye-crucible/templates/2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/templates/2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/2/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/templates/2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/templates/2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/3/Makefile b/linux/ecosystem/atlassian/fisheye-crucible/templates/3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/3/Makefile +++ b/linux/ecosystem/atlassian/fisheye-crucible/templates/3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/templates/3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/3/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/templates/3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/templates/3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/4/Makefile b/linux/ecosystem/atlassian/fisheye-crucible/templates/4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/4/Makefile +++ b/linux/ecosystem/atlassian/fisheye-crucible/templates/4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye-crucible/templates/4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye-crucible/templates/4/requirements.txt b/linux/ecosystem/atlassian/fisheye-crucible/templates/4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye-crucible/templates/4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye-crucible/templates/4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.0.1a/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.0.1a/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.0.1a/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.0.1a/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.0.1a/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.0.1a/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.0.1a/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.1.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.1.3/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.2.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.2.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.2.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.2.5/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.2.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.2.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.2.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.3/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.4/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.3.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.5/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.3.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.3.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.3.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.6/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.3.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.3.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.7/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.3.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.7/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.3.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.7/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.3.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.8/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.3.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.3.8/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.3.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.3.8/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.3.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4.1/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4.2/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4.3/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.4/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.1/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.2/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.3/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5.4/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.5/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.0/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.0/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.0Beta2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.1/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.3/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.3/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.4/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.4/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.5.a/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.5/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.5/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.5/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.5a/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.5a/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.5a/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.5a/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.5a/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.5a/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.5a/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.6/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/1/1.6.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/1/1.6.6/requirements.txt b/linux/ecosystem/atlassian/fisheye/1/1.6.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/1/1.6.6/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/1/1.6.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/fisheye/templates/1/Makefile b/linux/ecosystem/atlassian/fisheye/templates/1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/fisheye/templates/1/Makefile +++ b/linux/ecosystem/atlassian/fisheye/templates/1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/fisheye/templates/1/kaniko-build.py b/linux/ecosystem/atlassian/fisheye/templates/1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/fisheye/templates/1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/fisheye/templates/1/requirements.txt b/linux/ecosystem/atlassian/fisheye/templates/1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/fisheye/templates/1/requirements.txt +++ b/linux/ecosystem/atlassian/fisheye/templates/1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.1.1/Makefile b/linux/ecosystem/atlassian/jira/4/4.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.1.1/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.1.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.1.1/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.1.2/Makefile b/linux/ecosystem/atlassian/jira/4/4.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.1.2/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.1.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.1.2/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.2.1/Makefile b/linux/ecosystem/atlassian/jira/4/4.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.1/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.2.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.2.1/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.2.2/Makefile b/linux/ecosystem/atlassian/jira/4/4.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.2/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.2.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.2.2/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.2.3/Makefile b/linux/ecosystem/atlassian/jira/4/4.2.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.3/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.2.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.2.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.2.3/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.2.4/Makefile b/linux/ecosystem/atlassian/jira/4/4.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.4/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.2.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.2.4/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.2/Makefile b/linux/ecosystem/atlassian/jira/4/4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.2/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.3.1/Makefile b/linux/ecosystem/atlassian/jira/4/4.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.1/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.3.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.3.1/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.3.2/Makefile b/linux/ecosystem/atlassian/jira/4/4.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.2/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.3.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.3.2/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.3.3/Makefile b/linux/ecosystem/atlassian/jira/4/4.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.3/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.3.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.3.3/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.3.4/Makefile b/linux/ecosystem/atlassian/jira/4/4.3.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.4/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.3.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.3.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.3.4/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.3/Makefile b/linux/ecosystem/atlassian/jira/4/4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.3/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.4.1/Makefile b/linux/ecosystem/atlassian/jira/4/4.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.1/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.4.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.4.1/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.4.3/Makefile b/linux/ecosystem/atlassian/jira/4/4.4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.3/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.4.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.4.3/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.4.4/Makefile b/linux/ecosystem/atlassian/jira/4/4.4.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.4/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.4.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.4.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.4.4/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.4.5/Makefile b/linux/ecosystem/atlassian/jira/4/4.4.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.5/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.4.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.4.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.4.5/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/4/4.4/Makefile b/linux/ecosystem/atlassian/jira/4/4.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4/Makefile +++ b/linux/ecosystem/atlassian/jira/4/4.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/4/4.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/4/4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/4/4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/4/4.4/requirements.txt b/linux/ecosystem/atlassian/jira/4/4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/4/4.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/4/4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.1/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.1/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.1/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.2/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.2/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.2/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.3/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.3/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.3/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.4/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.4/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.4/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.5/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.5/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.5/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.6/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.6/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.6/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0.7/Makefile b/linux/ecosystem/atlassian/jira/5/5.0.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.7/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0.7/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.0/Makefile b/linux/ecosystem/atlassian/jira/5/5.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.0/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.1/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.1/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.1/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.2/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.2/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.2/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.3/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.3/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.3/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.4/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.4/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.4/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.5/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.5/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.5/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.6/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.6/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.6/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.7/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.7/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.7/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1.8/Makefile b/linux/ecosystem/atlassian/jira/5/5.1.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.8/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1.8/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.1/Makefile b/linux/ecosystem/atlassian/jira/5/5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.1/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.1/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.1/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.1/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.10/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.10/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.10/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.11/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.11/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.11/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.2/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.2/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.2/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.3/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.3/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.3/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.4.1/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.4.1/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.4.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.4.1/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.4/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.4/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.4/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.5/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.5/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.5/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.6/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.6/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.6/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.7/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.7/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.7/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.8/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.8/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.8/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2.9/Makefile b/linux/ecosystem/atlassian/jira/5/5.2.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.9/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2.9/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/5/5.2/Makefile b/linux/ecosystem/atlassian/jira/5/5.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2/Makefile +++ b/linux/ecosystem/atlassian/jira/5/5.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/5/5.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/5/5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/5/5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/5/5.2/requirements.txt b/linux/ecosystem/atlassian/jira/5/5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/5/5.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/5/5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.1/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.1/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.1/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.2/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.2/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.2/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.3/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.3/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.3/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.4/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.4/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.4/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.5/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.5/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.5/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.6/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.6/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.6/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.7/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.7/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.7/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0.8/Makefile b/linux/ecosystem/atlassian/jira/6/6.0.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.8/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0.8/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.0/Makefile b/linux/ecosystem/atlassian/jira/6/6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.0/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.1/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.1/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.1/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.2/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.2/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.2/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.3/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.3/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.3/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.4/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.4/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.4/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.5/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.5/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.5/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.6/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.6/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.6/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.7/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.7/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.7/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.8/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.8/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.8/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1.9/Makefile b/linux/ecosystem/atlassian/jira/6/6.1.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.9/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1.9/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.1/Makefile b/linux/ecosystem/atlassian/jira/6/6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.1/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.1/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.1/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.1/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.2/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.2/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.2/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.3/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.3/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.3/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.4/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.4/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.4/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.5/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.5/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.5/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.6/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.6/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.6/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2.7/Makefile b/linux/ecosystem/atlassian/jira/6/6.2.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.7/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2.7/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.2/Makefile b/linux/ecosystem/atlassian/jira/6/6.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.2/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.1/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.1/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.1/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.10/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.10/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.10/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.11/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.11/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.11/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.12/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.12/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.12/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.13/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.13/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.13/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.14/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.14/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.14/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.15/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.15/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.15/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.3/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.3/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.3/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.4/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.4/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.4/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.5/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.5/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.5/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.6/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.6/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.6/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.7/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.7/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.7/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.8/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.8/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.8/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3.9/Makefile b/linux/ecosystem/atlassian/jira/6/6.3.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.9/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3.9/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.3/Makefile b/linux/ecosystem/atlassian/jira/6/6.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.3/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.1/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.1/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.1/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.10/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.10/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.10/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.11/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.11/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.11/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.12/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.12/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.12/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.13/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.13/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.13/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.14/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.14/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.14/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.2/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.2/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.2/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.3/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.3/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.3/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.4/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.4/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.4/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.5/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.5/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.5/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.6/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.6/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.6/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.7/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.7/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.7/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.8/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.8/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.8/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4.9/Makefile b/linux/ecosystem/atlassian/jira/6/6.4.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.9/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4.9/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/6/6.4/Makefile b/linux/ecosystem/atlassian/jira/6/6.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4/Makefile +++ b/linux/ecosystem/atlassian/jira/6/6.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/6/6.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/6/6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/6/6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/6/6.4/requirements.txt b/linux/ecosystem/atlassian/jira/6/6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/6/6.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/6/6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.10/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.10/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.10/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.11/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.11/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.11/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.5/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.5/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.5/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.0.9/Makefile b/linux/ecosystem/atlassian/jira/7/7.0.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.9/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.0.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.0.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.0.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.0.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.0.9/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.0.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.0.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.0.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.0-m01/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.0-m01/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.0-m01/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.0-m01/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.0-m01/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.0-m01/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.0-m01/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.0-m01/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.0-m01/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.0-m01/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.0-m01/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.10/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.10/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.10/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.6/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.6/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.6/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.7/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.7/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.7/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.8/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.8/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.8/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.1.9/Makefile b/linux/ecosystem/atlassian/jira/7/7.1.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.9/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.1.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.1.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.1.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.1.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.1.9/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.1.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.1.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.1.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.10.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.10.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.10.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.10.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.10.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.10.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.10.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.10.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.10.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.10.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.10.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.10.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.10.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.10.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.10.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.10.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.10.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.10.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.11.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.11.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.11.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.11.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.11.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.11.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.11.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.11.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.11.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.11.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.11.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.11.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.11.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.11.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.11.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.11.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.11.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.11.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.11.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.11.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.11.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.11.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.11.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.11.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.11.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.11.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.11.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.11.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.11.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.11.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.11.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.11.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.11.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.12.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.12.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.12.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.12.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.12.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.12.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.12.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.12.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.12.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.12.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.12.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.12.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.12.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.12.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.12.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.12.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.12.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.12.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.12.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.12.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.12.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.12.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.12.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.12.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.12.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.12.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.12.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.12.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.11/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.11/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.11/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.12/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.12/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.12/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.13/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.13/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.13/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.14/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.14/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.14/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.15/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.15/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.15/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.16/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.16/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.16/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.16/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.16/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.17/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.17/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.17/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.17/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.17/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.18/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.18/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.18/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.18/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.18/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.5/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.5/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.5/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.6/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.6/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.6/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.8/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.8/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.8/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.13.9/Makefile b/linux/ecosystem/atlassian/jira/7/7.13.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.9/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.13.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.13.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.13.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.13.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.13.9/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.13.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.13.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.13.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.10/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.10/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.10/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.11/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.11/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.11/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.12/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.12/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.12/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.13/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.13/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.13/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.14/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.14/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.14/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.15/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.15/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.15/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.6/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.6/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.6/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.7/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.7/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.7/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.8/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.8/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.8/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.2.9/Makefile b/linux/ecosystem/atlassian/jira/7/7.2.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.9/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.2.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.2.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.2.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.2.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.2.9/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.2.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.2.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.2.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.5/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.5/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.5/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.6/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.6/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.6/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.7/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.7/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.7/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.8/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.8/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.8/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.3.9/Makefile b/linux/ecosystem/atlassian/jira/7/7.3.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.9/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.3.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.3.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.3.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.3.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.3.9/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.3.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.3.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.3.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.5/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.5/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.5/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.4.6/Makefile b/linux/ecosystem/atlassian/jira/7/7.4.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.6/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.4.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.4.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.4.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.4.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.4.6/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.4.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.4.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.4.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.5.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.5.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.5.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.5.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.5.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.5.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.5.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.5.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.5.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.5.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.5.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.5.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.5.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.5.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.5.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.5.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.5.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.5.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.5.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.5.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.5.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.5.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.5.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.10/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.10/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.10/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.11/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.11/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.11/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.12/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.12/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.12/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.13/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.13/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.13/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.14/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.14/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.14/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.15/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.15/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.15/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.16/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.16/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.16/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.16/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.16/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.17/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.17/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.17/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.17/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.17/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.3/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.3/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.3/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.6/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.6/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.6/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.7/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.7/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.7/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.8/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.8/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.8/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.6.9/Makefile b/linux/ecosystem/atlassian/jira/7/7.6.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.9/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.6.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.6.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.6.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.6.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.6.9/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.6.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.6.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.6.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.7.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.7.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.7.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.7.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.7.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.7.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.7.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.7.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.7.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.7.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.7.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.7.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.7.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.7.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.7.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.8.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.8.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.8.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.8.1/Makefile b/linux/ecosystem/atlassian/jira/7/7.8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.1/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.8.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.8.1/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.8.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.8.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.8.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.8.4/Makefile b/linux/ecosystem/atlassian/jira/7/7.8.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.4/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.8.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.8.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.8.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.8.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.8.4/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.8.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.8.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.8.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.9.0/Makefile b/linux/ecosystem/atlassian/jira/7/7.9.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.9.0/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.9.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.9.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.9.0/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/7/7.9.2/Makefile b/linux/ecosystem/atlassian/jira/7/7.9.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/7/7.9.2/Makefile +++ b/linux/ecosystem/atlassian/jira/7/7.9.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/7/7.9.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/7/7.9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/7/7.9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/7/7.9.2/requirements.txt b/linux/ecosystem/atlassian/jira/7/7.9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/7/7.9.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/7/7.9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.0.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.0.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.0.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.0.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.0.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.0.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.0.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.0.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.0.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.0.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.0.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.0.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.0.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.0.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.0.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.0.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.0.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.0.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.0.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.0.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.0.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.0.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.0.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.0.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.0.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.0.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.1.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.1.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.1.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.1.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.1.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.1.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.1.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.1.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.1.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.1.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.1.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.1.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.1.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.1.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.1.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.1.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.1.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.1.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.1.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.1.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.1.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.1.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.1.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.1.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.1.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.10.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.10.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.10.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.10.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.10.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.10.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.10.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.10.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.10.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.10.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.10.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.10.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.11.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.11.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.11.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.11.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.11.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.11.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.11.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.11.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.11.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.11.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.11.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.11.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.11.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.11.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.11.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.11.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.11.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.11.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.11.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.11.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.11.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.11.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.12.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.12.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.12.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.12.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.12.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.12.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.12.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.12.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.12.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.12.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.12.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.12.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.12.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.12.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.12.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.12.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.12.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.12.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.12.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.12.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.12.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.12.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.12.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.12.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.12.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.12.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.12.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.12.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.12.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.12.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.12.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.12.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.12.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.10/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.10/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.10/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.11/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.11/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.11/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.12/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.12/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.12/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.13/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.13/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.13/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.14/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.14/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.14/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.15/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.15/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.15/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.16/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.16/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.16/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.16/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.16/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.17/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.17/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.17/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.17/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.17/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.18/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.18/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.18/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.18/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.18/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.19/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.19/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.19/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.19/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.19/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.20/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.20/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.20/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.20/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.20/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.21/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.21/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.21/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.21/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.21/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.22/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.22/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.22/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.22/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.22/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.24/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.24/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.24/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.24/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.24/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.24/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.24/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.24/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.24/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.24/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.24/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.25/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.25/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.25/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.25/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.25/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.25/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.25/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.25/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.25/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.25/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.25/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.26/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.26/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.26/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.26/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.26/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.26/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.26/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.26/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.26/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.26/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.26/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.27/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.27/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.27/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.27/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.27/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.27/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.27/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.27/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.27/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.27/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.27/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.4/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.4/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.4/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.5/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.5/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.5/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.6/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.6/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.6/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.7/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.7/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.7/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.8/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.8/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.8/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.13.9/Makefile b/linux/ecosystem/atlassian/jira/8/8.13.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.9/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.13.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.13.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.13.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.13.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.13.9/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.13.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.13.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.13.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.14.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.14.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.14.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.14.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.14.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.14.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.14.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.14.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.14.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.14.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.14.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.14.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.14.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.14.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.14.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.14.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.14.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.14.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.14.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.14.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.14.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.14.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.15.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.15.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.15.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.15.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.15.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.15.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.15.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.15.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.15.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.15.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.15.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.15.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.15.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.15.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.15.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.15.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.15.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.15.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.15.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.15.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.15.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.15.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.16.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.16.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.16.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.16.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.16.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.16.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.16.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.16.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.16.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.16.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.16.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.16.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.16.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.16.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.16.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.16.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.16.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.16.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.16.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.16.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.16.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.16.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.16.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.16.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.16.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.16.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.16.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.16.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.16.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.16.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.16.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.16.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.16.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.17.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.17.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.17.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.17.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.17.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.17.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.17.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.17.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.17.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.17.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.17.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.17.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.17.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.17.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.17.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.17.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.17.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.17.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.17.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.17.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.17.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.17.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.18.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.18.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.18.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.18.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.18.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.18.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.18.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.18.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.18.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.18.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.18.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.18.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.18.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.18.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.18.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.18.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.18.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.18.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.18.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.18.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.18.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.18.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.19.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.19.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.19.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.19.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.19.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.19.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.19.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.19.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.19.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.19.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.19.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.19.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.19.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.19.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.19.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.19.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.19.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.19.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.19.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.19.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.19.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.19.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.4/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.4/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.4/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.5/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.5/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.5/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.2.6/Makefile b/linux/ecosystem/atlassian/jira/8/8.2.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.6/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.2.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.2.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.2.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.2.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.2.6/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.2.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.2.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.2.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.10/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.10/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.10/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.11/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.11/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.11/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.12/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.12/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.12/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.13/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.13/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.13/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.14/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.14/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.14/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.15/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.15/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.15/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.16/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.16/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.16/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.16/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.16/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.17/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.17/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.17/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.17/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.17/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.19/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.19/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.19/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.19/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.19/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.20/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.20/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.20/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.20/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.20/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.21/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.21/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.21/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.21/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.21/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.22/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.22/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.22/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.22/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.22/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.23/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.23/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.23/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.23/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.23/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.23/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.23/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.23/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.23/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.23/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.23/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.24/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.24/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.24/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.24/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.24/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.24/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.24/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.24/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.24/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.24/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.24/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.25/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.25/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.25/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.25/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.25/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.25/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.25/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.25/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.25/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.25/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.25/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.26/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.26/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.26/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.26/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.26/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.26/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.26/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.26/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.26/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.26/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.26/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.27/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.27/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.27/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.27/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.27/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.27/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.27/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.27/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.27/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.27/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.27/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.28/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.28/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.28/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.28/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.28/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.28/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.28/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.28/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.28/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.28/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.28/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.29/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.29/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.29/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.29/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.29/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.29/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.29/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.29/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.29/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.29/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.29/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.30/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.30/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.30/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.30/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.30/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.30/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.30/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.30/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.30/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.30/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.30/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.4/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.4/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.4/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.5/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.5/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.5/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.6/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.6/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.6/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.7/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.7/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.7/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.8/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.8/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.8/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.20.9/Makefile b/linux/ecosystem/atlassian/jira/8/8.20.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.9/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.20.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.20.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.20.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.20.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.20.9/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.20.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.20.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.20.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.21.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.21.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.21.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.21.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.21.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.21.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.21.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.21.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.21.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.21.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.21.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.21.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.21.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.21.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.21.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.21.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.21.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.21.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.21.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.21.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.21.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.21.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.4/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.4/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.4/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.5/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.5/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.5/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.22.6/Makefile b/linux/ecosystem/atlassian/jira/8/8.22.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.6/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.22.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.22.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.22.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.22.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.22.6/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.22.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.22.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.22.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.3.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.3.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.3.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.3.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.3.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.3.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.3.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.3.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.3.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.3.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.3.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.3.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.3.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.3.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.3.4/Makefile b/linux/ecosystem/atlassian/jira/8/8.3.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.4/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.3.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.3.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.3.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.3.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.3.4/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.3.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.3.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.3.5/Makefile b/linux/ecosystem/atlassian/jira/8/8.3.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.5/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.3.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.3.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.3.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.3.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.3.5/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.3.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.3.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.3.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.4.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.4.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.4.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.4.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.4.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.4.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.4.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.4.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.4.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.4.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.4.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.4.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.10/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.10/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.10/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.11/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.11/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.11/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.12/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.12/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.12/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.13/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.13/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.13/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.13/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.13/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.14/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.14/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.14/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.15/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.15/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.15/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.16/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.16/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.16/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.16/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.16/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.17/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.17/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.17/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.17/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.17/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.18/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.18/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.18/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.18/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.18/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.19/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.19/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.19/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.19/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.19/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.2/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.2/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.2/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.3/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.3/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.3/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.4/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.4/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.4/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.5/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.5/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.5/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.6/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.6/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.6/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.7/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.7/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.7/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.8/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.8/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.8/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.5.9/Makefile b/linux/ecosystem/atlassian/jira/8/8.5.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.9/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.5.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.5.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.5.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.5.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.5.9/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.5.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.5.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.5.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.6.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.6.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.6.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.6.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.6.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.6.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.6.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.6.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.6.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.6.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.6.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.7.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.7.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.7.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.7.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.7.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.7.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.7.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.7.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.8.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.8.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.8.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.8.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.8.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.8.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.8.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.8.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.9.0/Makefile b/linux/ecosystem/atlassian/jira/8/8.9.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.9.0/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.9.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.9.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.9.0/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/8/8.9.1/Makefile b/linux/ecosystem/atlassian/jira/8/8.9.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/8/8.9.1/Makefile +++ b/linux/ecosystem/atlassian/jira/8/8.9.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/8/8.9.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/8/8.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/8/8.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/8/8.9.1/requirements.txt b/linux/ecosystem/atlassian/jira/8/8.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/8/8.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/8/8.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.0.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.0.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.0.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.0.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.0.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.0.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.0.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.0.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.0.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.0.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.0.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.1.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.1.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.1.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.1.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.1.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.1.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.1.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.1.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.1.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.1.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.1.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.1.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.1.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.1.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.1.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.1.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.1.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.1.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.1.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.1.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.1.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.1.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.10.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.10.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.10.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.10.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.10.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.10.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.10.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.10.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.10.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.10.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.10.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.10.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.10.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.10.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.10.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.10.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.10.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.10.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.10.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.10.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.10.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.10.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.10.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.10.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.10.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.10.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.10.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.10.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.10.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.10.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.10.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.10.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.10.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.11.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.11.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.11.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.11.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.11.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.11.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.11.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.11.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.11.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.11.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.11.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.11.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.11.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.11.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.11.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.11.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.11.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.11.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.11.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.11.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.11.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.11.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.11.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.11.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.11.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.11.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.11.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.11.3/Makefile b/linux/ecosystem/atlassian/jira/9/9.11.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.3/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.11.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.11.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.11.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.11.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.11.3/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.11.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.11.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.11.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.12.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.12.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.12.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.12.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.12.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.12.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.12.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.12.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.12.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.12.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.12.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.12.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.12.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.12.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.12.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.12.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.12.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.12.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.12.12/Makefile b/linux/ecosystem/atlassian/jira/9/9.12.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.12/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.12.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.12.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.12.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.12.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.12.12/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.12.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.12.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.12.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.12.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.12.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.12.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.12.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.12.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.12.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.12.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.12.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.12.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.14.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.14.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.14.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.14.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.14.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.14.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.14.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.14.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.14.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.14.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.14.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.16.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.16.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.16.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.16.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.16.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.16.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.16.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.16.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.16.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.16.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.16.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.17.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.17.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.17.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.17.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.17.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.17.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.17.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.17.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.17.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.17.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.17.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.2.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.2.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.2.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.2.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.2.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.2.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.2.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.2.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.2.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.2.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.2.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.2.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.2.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.2.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.2.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.2.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.2.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.2.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.2.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.2.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.2.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.2.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.3.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.3.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.3.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.3.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.3.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.3.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.3.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.3.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.3.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.3.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.3.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.3.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.3.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.3.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.3.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.3.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.3.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.3.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.3.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.3.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.3.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.3.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.3.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.3.3/Makefile b/linux/ecosystem/atlassian/jira/9/9.3.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.3/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.3.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.3.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.3.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.3.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.3.3/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.3.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.3.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.3.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.10/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.10/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.10/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.10/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.10/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.11/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.11/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.11/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.11/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.11/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.12/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.12/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.12/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.12/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.12/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.14/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.14/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.14/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.14/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.14/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.15/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.15/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.15/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.15/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.15/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.3/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.3/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.3/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.3/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.3/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.4/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.4/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.4/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.4/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.4/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.5/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.5/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.5/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.5/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.5/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.6/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.6/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.6/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.6/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.6/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.7/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.7/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.7/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.7/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.7/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.8/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.8/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.8/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.8/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.8/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.4.9/Makefile b/linux/ecosystem/atlassian/jira/9/9.4.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.9/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.4.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.4.9/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.4.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.4.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.4.9/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.4.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.4.9/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.4.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.5.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.5.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.5.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.5.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.5.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.5.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.5.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.5.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.5.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.5.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.5.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.5.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.5.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.5.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.6.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.6.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.6.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.6.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.6.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.6.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.6.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.7.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.7.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.7.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.7.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.7.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.7.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.7.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.7.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.7.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.7.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.7.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.7.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.7.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.7.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.7.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.8.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.8.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.8.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.8.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.8.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.8.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.8.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.8.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.8.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.8.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.8.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.8.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.8.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.8.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.8.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.9.0/Makefile b/linux/ecosystem/atlassian/jira/9/9.9.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.9.0/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.9.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.9.0/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.9.0/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.9.0/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.9.1/Makefile b/linux/ecosystem/atlassian/jira/9/9.9.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.9.1/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.9.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.9.1/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.9.1/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.9.1/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/9/9.9.2/Makefile b/linux/ecosystem/atlassian/jira/9/9.9.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/9/9.9.2/Makefile +++ b/linux/ecosystem/atlassian/jira/9/9.9.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/9/9.9.2/kaniko-build.py b/linux/ecosystem/atlassian/jira/9/9.9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/9/9.9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/9/9.9.2/requirements.txt b/linux/ecosystem/atlassian/jira/9/9.9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/9/9.9.2/requirements.txt +++ b/linux/ecosystem/atlassian/jira/9/9.9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/atlassian/jira/latest/Makefile b/linux/ecosystem/atlassian/jira/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/atlassian/jira/latest/Makefile +++ b/linux/ecosystem/atlassian/jira/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/atlassian/jira/latest/kaniko-build.py b/linux/ecosystem/atlassian/jira/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/atlassian/jira/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/atlassian/jira/latest/requirements.txt b/linux/ecosystem/atlassian/jira/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/atlassian/jira/latest/requirements.txt +++ b/linux/ecosystem/atlassian/jira/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/cassandra/3.11/Makefile b/linux/ecosystem/cassandra/3.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/cassandra/3.11/Makefile +++ b/linux/ecosystem/cassandra/3.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/cassandra/3.11/kaniko-build.py b/linux/ecosystem/cassandra/3.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/cassandra/3.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/cassandra/3.11/requirements.txt b/linux/ecosystem/cassandra/3.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/cassandra/3.11/requirements.txt +++ b/linux/ecosystem/cassandra/3.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/electron-release-server/Makefile b/linux/ecosystem/electron-release-server/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/electron-release-server/Makefile +++ b/linux/ecosystem/electron-release-server/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/electron-release-server/kaniko-build.py b/linux/ecosystem/electron-release-server/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/electron-release-server/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/electron-release-server/requirements.txt b/linux/ecosystem/electron-release-server/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/electron-release-server/requirements.txt +++ b/linux/ecosystem/electron-release-server/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/develop/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/develop/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/develop/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/develop/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/main/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/main/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/main/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/main/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/main/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/python3.13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/slim/Makefile b/linux/ecosystem/epicmorg/astra/1.7-alse/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/slim/Makefile +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/slim/kaniko-build.py b/linux/ecosystem/epicmorg/astra/1.7-alse/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/astra/1.7-alse/slim/requirements.txt b/linux/ecosystem/epicmorg/astra/1.7-alse/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/astra/1.7-alse/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/astra/1.7-alse/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/develop/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/main/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/main/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/slim/Makefile b/linux/ecosystem/epicmorg/debian/06-squeeze/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/06-squeeze/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/06-squeeze/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/06-squeeze/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/06-squeeze/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/06-squeeze/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/develop/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/main/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/main/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/slim/Makefile b/linux/ecosystem/epicmorg/debian/07-wheezy/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/07-wheezy/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/07-wheezy/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/07-wheezy/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/07-wheezy/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/07-wheezy/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/develop/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/main/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/main/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/slim/Makefile b/linux/ecosystem/epicmorg/debian/08-jessie/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/08-jessie/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/08-jessie/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/08-jessie/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/08-jessie/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/08-jessie/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/08-jessie/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/08-jessie/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/develop/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/main/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/main/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/slim/Makefile b/linux/ecosystem/epicmorg/debian/09-stretch/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/09-stretch/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/09-stretch/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/09-stretch/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/09-stretch/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/09-stretch/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/09-stretch/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/09-stretch/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/develop/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/main/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/main/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/10-buster/slim/Makefile b/linux/ecosystem/epicmorg/debian/10-buster/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/10-buster/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/10-buster/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/10-buster/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/10-buster/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/10-buster/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/10-buster/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/10-buster/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/10-buster/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/develop/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/main/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/main/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/slim/Makefile b/linux/ecosystem/epicmorg/debian/11-bullseye/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/11-bullseye/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/11-bullseye/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/11-bullseye/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/11-bullseye/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/11-bullseye/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/develop/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/develop/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/develop/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/develop/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/develop/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/develop/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/develop/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/develop/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/develop/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/develop/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/develop/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/main/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/main/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/main/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/main/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/main/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/slim/Makefile b/linux/ecosystem/epicmorg/debian/12-bookworm/slim/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/slim/Makefile +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/slim/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/slim/kaniko-build.py b/linux/ecosystem/epicmorg/debian/12-bookworm/slim/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/slim/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/epicmorg/debian/12-bookworm/slim/requirements.txt b/linux/ecosystem/epicmorg/debian/12-bookworm/slim/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/epicmorg/debian/12-bookworm/slim/requirements.txt +++ b/linux/ecosystem/epicmorg/debian/12-bookworm/slim/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/Makefile b/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/Makefile +++ b/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/kaniko-build.py b/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/requirements.txt b/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/requirements.txt +++ b/linux/ecosystem/gitlab/runner/amxx-sdk/1.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/Makefile b/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/Makefile +++ b/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/kaniko-build.py b/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/requirements.txt b/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/requirements.txt +++ b/linux/ecosystem/gitlab/runner/amxx-sdk/1.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk11/Makefile b/linux/ecosystem/gitlab/runner/android-sdk/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk11/Makefile +++ b/linux/ecosystem/gitlab/runner/android-sdk/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk11/kaniko-build.py b/linux/ecosystem/gitlab/runner/android-sdk/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk11/requirements.txt b/linux/ecosystem/gitlab/runner/android-sdk/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk11/requirements.txt +++ b/linux/ecosystem/gitlab/runner/android-sdk/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk17/Makefile b/linux/ecosystem/gitlab/runner/android-sdk/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk17/Makefile +++ b/linux/ecosystem/gitlab/runner/android-sdk/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk17/kaniko-build.py b/linux/ecosystem/gitlab/runner/android-sdk/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk17/requirements.txt b/linux/ecosystem/gitlab/runner/android-sdk/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk17/requirements.txt +++ b/linux/ecosystem/gitlab/runner/android-sdk/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk8/Makefile b/linux/ecosystem/gitlab/runner/android-sdk/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk8/Makefile +++ b/linux/ecosystem/gitlab/runner/android-sdk/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk8/kaniko-build.py b/linux/ecosystem/gitlab/runner/android-sdk/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/android-sdk/jdk8/requirements.txt b/linux/ecosystem/gitlab/runner/android-sdk/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/android-sdk/jdk8/requirements.txt +++ b/linux/ecosystem/gitlab/runner/android-sdk/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/atlassian-sdk/Makefile b/linux/ecosystem/gitlab/runner/atlassian-sdk/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/atlassian-sdk/Makefile +++ b/linux/ecosystem/gitlab/runner/atlassian-sdk/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/atlassian-sdk/kaniko-build.py b/linux/ecosystem/gitlab/runner/atlassian-sdk/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/atlassian-sdk/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/atlassian-sdk/requirements.txt b/linux/ecosystem/gitlab/runner/atlassian-sdk/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/atlassian-sdk/requirements.txt +++ b/linux/ecosystem/gitlab/runner/atlassian-sdk/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/dotnet-sdk/Makefile b/linux/ecosystem/gitlab/runner/dotnet-sdk/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/dotnet-sdk/Makefile +++ b/linux/ecosystem/gitlab/runner/dotnet-sdk/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/dotnet-sdk/kaniko-build.py b/linux/ecosystem/gitlab/runner/dotnet-sdk/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/dotnet-sdk/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/dotnet-sdk/requirements.txt b/linux/ecosystem/gitlab/runner/dotnet-sdk/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/dotnet-sdk/requirements.txt +++ b/linux/ecosystem/gitlab/runner/dotnet-sdk/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/latest/Makefile b/linux/ecosystem/gitlab/runner/latest/Makefile index 102f672d0..9fa705b74 100644 --- a/linux/ecosystem/gitlab/runner/latest/Makefile +++ b/linux/ecosystem/gitlab/runner/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/latest/kaniko-build.py b/linux/ecosystem/gitlab/runner/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/latest/requirements.txt b/linux/ecosystem/gitlab/runner/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/latest/requirements.txt +++ b/linux/ecosystem/gitlab/runner/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node0.12/Makefile b/linux/ecosystem/gitlab/runner/node0.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node0.12/Makefile +++ b/linux/ecosystem/gitlab/runner/node0.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node0.12/kaniko-build.py b/linux/ecosystem/gitlab/runner/node0.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node0.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node0.12/requirements.txt b/linux/ecosystem/gitlab/runner/node0.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node0.12/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node0.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node10/Makefile b/linux/ecosystem/gitlab/runner/node10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node10/Makefile +++ b/linux/ecosystem/gitlab/runner/node10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node10/kaniko-build.py b/linux/ecosystem/gitlab/runner/node10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node10/requirements.txt b/linux/ecosystem/gitlab/runner/node10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node10/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node11/Makefile b/linux/ecosystem/gitlab/runner/node11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node11/Makefile +++ b/linux/ecosystem/gitlab/runner/node11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node11/kaniko-build.py b/linux/ecosystem/gitlab/runner/node11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node11/requirements.txt b/linux/ecosystem/gitlab/runner/node11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node11/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node12/Makefile b/linux/ecosystem/gitlab/runner/node12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node12/Makefile +++ b/linux/ecosystem/gitlab/runner/node12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node12/kaniko-build.py b/linux/ecosystem/gitlab/runner/node12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node12/requirements.txt b/linux/ecosystem/gitlab/runner/node12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node12/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node13/Makefile b/linux/ecosystem/gitlab/runner/node13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node13/Makefile +++ b/linux/ecosystem/gitlab/runner/node13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node13/kaniko-build.py b/linux/ecosystem/gitlab/runner/node13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node13/requirements.txt b/linux/ecosystem/gitlab/runner/node13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node13/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node14/Makefile b/linux/ecosystem/gitlab/runner/node14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node14/Makefile +++ b/linux/ecosystem/gitlab/runner/node14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node14/kaniko-build.py b/linux/ecosystem/gitlab/runner/node14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node14/requirements.txt b/linux/ecosystem/gitlab/runner/node14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node14/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node15/Makefile b/linux/ecosystem/gitlab/runner/node15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node15/Makefile +++ b/linux/ecosystem/gitlab/runner/node15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node15/kaniko-build.py b/linux/ecosystem/gitlab/runner/node15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node15/requirements.txt b/linux/ecosystem/gitlab/runner/node15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node15/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node16/Makefile b/linux/ecosystem/gitlab/runner/node16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node16/Makefile +++ b/linux/ecosystem/gitlab/runner/node16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node16/kaniko-build.py b/linux/ecosystem/gitlab/runner/node16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node16/requirements.txt b/linux/ecosystem/gitlab/runner/node16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node16/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node17/Makefile b/linux/ecosystem/gitlab/runner/node17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node17/Makefile +++ b/linux/ecosystem/gitlab/runner/node17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node17/kaniko-build.py b/linux/ecosystem/gitlab/runner/node17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node17/requirements.txt b/linux/ecosystem/gitlab/runner/node17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node17/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node18/Makefile b/linux/ecosystem/gitlab/runner/node18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node18/Makefile +++ b/linux/ecosystem/gitlab/runner/node18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node18/kaniko-build.py b/linux/ecosystem/gitlab/runner/node18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node18/requirements.txt b/linux/ecosystem/gitlab/runner/node18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node18/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node19/Makefile b/linux/ecosystem/gitlab/runner/node19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node19/Makefile +++ b/linux/ecosystem/gitlab/runner/node19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node19/kaniko-build.py b/linux/ecosystem/gitlab/runner/node19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node19/requirements.txt b/linux/ecosystem/gitlab/runner/node19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node19/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node20/Makefile b/linux/ecosystem/gitlab/runner/node20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node20/Makefile +++ b/linux/ecosystem/gitlab/runner/node20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node20/kaniko-build.py b/linux/ecosystem/gitlab/runner/node20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node20/requirements.txt b/linux/ecosystem/gitlab/runner/node20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node20/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node21/Makefile b/linux/ecosystem/gitlab/runner/node21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node21/Makefile +++ b/linux/ecosystem/gitlab/runner/node21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node21/kaniko-build.py b/linux/ecosystem/gitlab/runner/node21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node21/requirements.txt b/linux/ecosystem/gitlab/runner/node21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node21/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node22/Makefile b/linux/ecosystem/gitlab/runner/node22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node22/Makefile +++ b/linux/ecosystem/gitlab/runner/node22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node22/kaniko-build.py b/linux/ecosystem/gitlab/runner/node22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node22/requirements.txt b/linux/ecosystem/gitlab/runner/node22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node22/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node4/Makefile b/linux/ecosystem/gitlab/runner/node4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node4/Makefile +++ b/linux/ecosystem/gitlab/runner/node4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node4/kaniko-build.py b/linux/ecosystem/gitlab/runner/node4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node4/requirements.txt b/linux/ecosystem/gitlab/runner/node4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node4/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node5/Makefile b/linux/ecosystem/gitlab/runner/node5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node5/Makefile +++ b/linux/ecosystem/gitlab/runner/node5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node5/kaniko-build.py b/linux/ecosystem/gitlab/runner/node5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node5/requirements.txt b/linux/ecosystem/gitlab/runner/node5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node5/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node6/Makefile b/linux/ecosystem/gitlab/runner/node6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node6/Makefile +++ b/linux/ecosystem/gitlab/runner/node6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node6/kaniko-build.py b/linux/ecosystem/gitlab/runner/node6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node6/requirements.txt b/linux/ecosystem/gitlab/runner/node6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node6/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node7/Makefile b/linux/ecosystem/gitlab/runner/node7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node7/Makefile +++ b/linux/ecosystem/gitlab/runner/node7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node7/kaniko-build.py b/linux/ecosystem/gitlab/runner/node7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node7/requirements.txt b/linux/ecosystem/gitlab/runner/node7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node7/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node8/Makefile b/linux/ecosystem/gitlab/runner/node8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node8/Makefile +++ b/linux/ecosystem/gitlab/runner/node8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node8/kaniko-build.py b/linux/ecosystem/gitlab/runner/node8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node8/requirements.txt b/linux/ecosystem/gitlab/runner/node8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node8/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/node9/Makefile b/linux/ecosystem/gitlab/runner/node9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/node9/Makefile +++ b/linux/ecosystem/gitlab/runner/node9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/node9/kaniko-build.py b/linux/ecosystem/gitlab/runner/node9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/node9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/node9/requirements.txt b/linux/ecosystem/gitlab/runner/node9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/node9/requirements.txt +++ b/linux/ecosystem/gitlab/runner/node9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php7.2/Makefile b/linux/ecosystem/gitlab/runner/php7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php7.2/Makefile +++ b/linux/ecosystem/gitlab/runner/php7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php7.2/kaniko-build.py b/linux/ecosystem/gitlab/runner/php7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php7.2/requirements.txt b/linux/ecosystem/gitlab/runner/php7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php7.2/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php7.3/Makefile b/linux/ecosystem/gitlab/runner/php7.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php7.3/Makefile +++ b/linux/ecosystem/gitlab/runner/php7.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php7.3/kaniko-build.py b/linux/ecosystem/gitlab/runner/php7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php7.3/requirements.txt b/linux/ecosystem/gitlab/runner/php7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php7.3/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php7.4/Makefile b/linux/ecosystem/gitlab/runner/php7.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php7.4/Makefile +++ b/linux/ecosystem/gitlab/runner/php7.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php7.4/kaniko-build.py b/linux/ecosystem/gitlab/runner/php7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php7.4/requirements.txt b/linux/ecosystem/gitlab/runner/php7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php7.4/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php8.0/Makefile b/linux/ecosystem/gitlab/runner/php8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php8.0/Makefile +++ b/linux/ecosystem/gitlab/runner/php8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php8.0/kaniko-build.py b/linux/ecosystem/gitlab/runner/php8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php8.0/requirements.txt b/linux/ecosystem/gitlab/runner/php8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php8.0/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php8.1/Makefile b/linux/ecosystem/gitlab/runner/php8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php8.1/Makefile +++ b/linux/ecosystem/gitlab/runner/php8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php8.1/kaniko-build.py b/linux/ecosystem/gitlab/runner/php8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php8.1/requirements.txt b/linux/ecosystem/gitlab/runner/php8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php8.1/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php8.2/Makefile b/linux/ecosystem/gitlab/runner/php8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php8.2/Makefile +++ b/linux/ecosystem/gitlab/runner/php8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php8.2/kaniko-build.py b/linux/ecosystem/gitlab/runner/php8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php8.2/requirements.txt b/linux/ecosystem/gitlab/runner/php8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php8.2/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/php8.3/Makefile b/linux/ecosystem/gitlab/runner/php8.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/php8.3/Makefile +++ b/linux/ecosystem/gitlab/runner/php8.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/php8.3/kaniko-build.py b/linux/ecosystem/gitlab/runner/php8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/php8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/php8.3/requirements.txt b/linux/ecosystem/gitlab/runner/php8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/php8.3/requirements.txt +++ b/linux/ecosystem/gitlab/runner/php8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/gitlab/runner/steam-sdk/Makefile b/linux/ecosystem/gitlab/runner/steam-sdk/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/gitlab/runner/steam-sdk/Makefile +++ b/linux/ecosystem/gitlab/runner/steam-sdk/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/gitlab/runner/steam-sdk/kaniko-build.py b/linux/ecosystem/gitlab/runner/steam-sdk/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/gitlab/runner/steam-sdk/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/gitlab/runner/steam-sdk/requirements.txt b/linux/ecosystem/gitlab/runner/steam-sdk/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/gitlab/runner/steam-sdk/requirements.txt +++ b/linux/ecosystem/gitlab/runner/steam-sdk/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/monero/monerod/Makefile b/linux/ecosystem/monero/monerod/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/monero/monerod/Makefile +++ b/linux/ecosystem/monero/monerod/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/monero/monerod/kaniko-build.py b/linux/ecosystem/monero/monerod/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/monero/monerod/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/monero/monerod/requirements.txt b/linux/ecosystem/monero/monerod/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/monero/monerod/requirements.txt +++ b/linux/ecosystem/monero/monerod/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/monero/p2pool/Makefile b/linux/ecosystem/monero/p2pool/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/monero/p2pool/Makefile +++ b/linux/ecosystem/monero/p2pool/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/monero/p2pool/kaniko-build.py b/linux/ecosystem/monero/p2pool/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/monero/p2pool/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/monero/p2pool/requirements.txt b/linux/ecosystem/monero/p2pool/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/monero/p2pool/requirements.txt +++ b/linux/ecosystem/monero/p2pool/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.14.2/main/Makefile b/linux/ecosystem/nginx/1.14.2/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.14.2/main/Makefile +++ b/linux/ecosystem/nginx/1.14.2/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.14.2/main/kaniko-build.py b/linux/ecosystem/nginx/1.14.2/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.14.2/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.14.2/main/requirements.txt b/linux/ecosystem/nginx/1.14.2/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.14.2/main/requirements.txt +++ b/linux/ecosystem/nginx/1.14.2/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.14.2/php/Makefile b/linux/ecosystem/nginx/1.14.2/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.14.2/php/Makefile +++ b/linux/ecosystem/nginx/1.14.2/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.14.2/php/kaniko-build.py b/linux/ecosystem/nginx/1.14.2/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.14.2/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.14.2/php/requirements.txt b/linux/ecosystem/nginx/1.14.2/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.14.2/php/requirements.txt +++ b/linux/ecosystem/nginx/1.14.2/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.14.2/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.14.2/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.14.2/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.14.2/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.14.2/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.14.2/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.14.2/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.14.2/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.14.2/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.14.2/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.14.2/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.15.12/main/Makefile b/linux/ecosystem/nginx/1.15.12/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.15.12/main/Makefile +++ b/linux/ecosystem/nginx/1.15.12/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.15.12/main/kaniko-build.py b/linux/ecosystem/nginx/1.15.12/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.15.12/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.15.12/main/requirements.txt b/linux/ecosystem/nginx/1.15.12/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.15.12/main/requirements.txt +++ b/linux/ecosystem/nginx/1.15.12/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.15.12/php/Makefile b/linux/ecosystem/nginx/1.15.12/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.15.12/php/Makefile +++ b/linux/ecosystem/nginx/1.15.12/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.15.12/php/kaniko-build.py b/linux/ecosystem/nginx/1.15.12/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.15.12/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.15.12/php/requirements.txt b/linux/ecosystem/nginx/1.15.12/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.15.12/php/requirements.txt +++ b/linux/ecosystem/nginx/1.15.12/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.15.12/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.15.12/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.15.12/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.15.12/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.15.12/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.15.12/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.15.12/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.15.12/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.15.12/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.15.12/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.15.12/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.16.1/main/Makefile b/linux/ecosystem/nginx/1.16.1/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.16.1/main/Makefile +++ b/linux/ecosystem/nginx/1.16.1/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.16.1/main/kaniko-build.py b/linux/ecosystem/nginx/1.16.1/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.16.1/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.16.1/main/requirements.txt b/linux/ecosystem/nginx/1.16.1/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.16.1/main/requirements.txt +++ b/linux/ecosystem/nginx/1.16.1/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.16.1/php/Makefile b/linux/ecosystem/nginx/1.16.1/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.16.1/php/Makefile +++ b/linux/ecosystem/nginx/1.16.1/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.16.1/php/kaniko-build.py b/linux/ecosystem/nginx/1.16.1/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.16.1/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.16.1/php/requirements.txt b/linux/ecosystem/nginx/1.16.1/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.16.1/php/requirements.txt +++ b/linux/ecosystem/nginx/1.16.1/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.16.1/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.16.1/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.16.1/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.16.1/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.16.1/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.16.1/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.16.1/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.16.1/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.16.1/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.16.1/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.16.1/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.17.10/main/Makefile b/linux/ecosystem/nginx/1.17.10/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.17.10/main/Makefile +++ b/linux/ecosystem/nginx/1.17.10/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.17.10/main/kaniko-build.py b/linux/ecosystem/nginx/1.17.10/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.17.10/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.17.10/main/requirements.txt b/linux/ecosystem/nginx/1.17.10/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.17.10/main/requirements.txt +++ b/linux/ecosystem/nginx/1.17.10/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.17.10/php/Makefile b/linux/ecosystem/nginx/1.17.10/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.17.10/php/Makefile +++ b/linux/ecosystem/nginx/1.17.10/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.17.10/php/kaniko-build.py b/linux/ecosystem/nginx/1.17.10/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.17.10/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.17.10/php/requirements.txt b/linux/ecosystem/nginx/1.17.10/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.17.10/php/requirements.txt +++ b/linux/ecosystem/nginx/1.17.10/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.17.10/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.17.10/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.17.10/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.17.10/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.17.10/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.17.10/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.17.10/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.17.10/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.17.10/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.17.10/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.17.10/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.18.0/main/Makefile b/linux/ecosystem/nginx/1.18.0/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.18.0/main/Makefile +++ b/linux/ecosystem/nginx/1.18.0/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.18.0/main/kaniko-build.py b/linux/ecosystem/nginx/1.18.0/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.18.0/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.18.0/main/requirements.txt b/linux/ecosystem/nginx/1.18.0/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.18.0/main/requirements.txt +++ b/linux/ecosystem/nginx/1.18.0/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.18.0/php/Makefile b/linux/ecosystem/nginx/1.18.0/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.18.0/php/Makefile +++ b/linux/ecosystem/nginx/1.18.0/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.18.0/php/kaniko-build.py b/linux/ecosystem/nginx/1.18.0/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.18.0/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.18.0/php/requirements.txt b/linux/ecosystem/nginx/1.18.0/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.18.0/php/requirements.txt +++ b/linux/ecosystem/nginx/1.18.0/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.18.0/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.18.0/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.18.0/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.18.0/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.18.0/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.18.0/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.18.0/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.18.0/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.18.0/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.18.0/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.18.0/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.19.10/main/Makefile b/linux/ecosystem/nginx/1.19.10/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.19.10/main/Makefile +++ b/linux/ecosystem/nginx/1.19.10/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.19.10/main/kaniko-build.py b/linux/ecosystem/nginx/1.19.10/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.19.10/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.19.10/main/requirements.txt b/linux/ecosystem/nginx/1.19.10/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.19.10/main/requirements.txt +++ b/linux/ecosystem/nginx/1.19.10/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.19.10/php/Makefile b/linux/ecosystem/nginx/1.19.10/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.19.10/php/Makefile +++ b/linux/ecosystem/nginx/1.19.10/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.19.10/php/kaniko-build.py b/linux/ecosystem/nginx/1.19.10/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.19.10/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.19.10/php/requirements.txt b/linux/ecosystem/nginx/1.19.10/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.19.10/php/requirements.txt +++ b/linux/ecosystem/nginx/1.19.10/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.19.10/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.19.10/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.19.10/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.19.10/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.19.10/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.19.10/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.19.10/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.19.10/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.19.10/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.19.10/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.19.10/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.20.1/main/Makefile b/linux/ecosystem/nginx/1.20.1/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.20.1/main/Makefile +++ b/linux/ecosystem/nginx/1.20.1/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.20.1/main/kaniko-build.py b/linux/ecosystem/nginx/1.20.1/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.20.1/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.20.1/main/requirements.txt b/linux/ecosystem/nginx/1.20.1/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.20.1/main/requirements.txt +++ b/linux/ecosystem/nginx/1.20.1/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.20.1/php/Makefile b/linux/ecosystem/nginx/1.20.1/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.20.1/php/Makefile +++ b/linux/ecosystem/nginx/1.20.1/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.20.1/php/kaniko-build.py b/linux/ecosystem/nginx/1.20.1/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.20.1/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.20.1/php/requirements.txt b/linux/ecosystem/nginx/1.20.1/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.20.1/php/requirements.txt +++ b/linux/ecosystem/nginx/1.20.1/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.20.1/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.20.1/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.20.1/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.20.1/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.20.1/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.20.1/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.20.1/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.20.1/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.20.1/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.20.1/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.20.1/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.21.3/main/Makefile b/linux/ecosystem/nginx/1.21.3/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.21.3/main/Makefile +++ b/linux/ecosystem/nginx/1.21.3/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.21.3/main/kaniko-build.py b/linux/ecosystem/nginx/1.21.3/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.21.3/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.21.3/main/requirements.txt b/linux/ecosystem/nginx/1.21.3/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.21.3/main/requirements.txt +++ b/linux/ecosystem/nginx/1.21.3/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.21.3/php/Makefile b/linux/ecosystem/nginx/1.21.3/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.21.3/php/Makefile +++ b/linux/ecosystem/nginx/1.21.3/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.21.3/php/kaniko-build.py b/linux/ecosystem/nginx/1.21.3/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.21.3/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.21.3/php/requirements.txt b/linux/ecosystem/nginx/1.21.3/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.21.3/php/requirements.txt +++ b/linux/ecosystem/nginx/1.21.3/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.21.3/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.21.3/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.21.3/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.21.3/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.21.3/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.21.3/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.21.3/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.21.3/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.21.3/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.21.3/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.21.3/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.21.6/main/Makefile b/linux/ecosystem/nginx/1.21.6/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.21.6/main/Makefile +++ b/linux/ecosystem/nginx/1.21.6/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.21.6/main/kaniko-build.py b/linux/ecosystem/nginx/1.21.6/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.21.6/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.21.6/main/requirements.txt b/linux/ecosystem/nginx/1.21.6/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.21.6/main/requirements.txt +++ b/linux/ecosystem/nginx/1.21.6/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.21.6/php/Makefile b/linux/ecosystem/nginx/1.21.6/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.21.6/php/Makefile +++ b/linux/ecosystem/nginx/1.21.6/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.21.6/php/kaniko-build.py b/linux/ecosystem/nginx/1.21.6/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.21.6/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.21.6/php/requirements.txt b/linux/ecosystem/nginx/1.21.6/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.21.6/php/requirements.txt +++ b/linux/ecosystem/nginx/1.21.6/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.21.6/rtmp-hls/Makefile b/linux/ecosystem/nginx/1.21.6/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.21.6/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/1.21.6/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.21.6/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/1.21.6/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.21.6/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.21.6/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/1.21.6/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.21.6/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/1.21.6/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/1.27.0/main/Makefile b/linux/ecosystem/nginx/1.27.0/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/1.27.0/main/Makefile +++ b/linux/ecosystem/nginx/1.27.0/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/1.27.0/main/etc/nginx/nginx.conf b/linux/ecosystem/nginx/1.27.0/main/etc/nginx/nginx.conf index 18eef7a78..75dad302b 100644 --- a/linux/ecosystem/nginx/1.27.0/main/etc/nginx/nginx.conf +++ b/linux/ecosystem/nginx/1.27.0/main/etc/nginx/nginx.conf @@ -20,12 +20,17 @@ http { tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; - types_hash_max_size 2048; + types_hash_max_size 512; + types_hash_bucket_size 128; # server_tokens off; - # server_names_hash_bucket_size 64; + server_names_hash_max_size 512; + server_names_hash_bucket_size 128; # server_name_in_redirect off; + variables_hash_max_size 2048; + variables_hash_bucket_size 512; + include /etc/nginx/mime.types; default_type application/octet-stream; diff --git a/linux/ecosystem/nginx/1.27.0/main/kaniko-build.py b/linux/ecosystem/nginx/1.27.0/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/1.27.0/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/1.27.0/main/requirements.txt b/linux/ecosystem/nginx/1.27.0/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/1.27.0/main/requirements.txt +++ b/linux/ecosystem/nginx/1.27.0/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/latest/mainline/main/Makefile b/linux/ecosystem/nginx/latest/mainline/main/Makefile index 72aa38b1b..558bb3cb2 100644 --- a/linux/ecosystem/nginx/latest/mainline/main/Makefile +++ b/linux/ecosystem/nginx/latest/mainline/main/Makefile @@ -9,11 +9,11 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/latest/mainline/main/kaniko-build.py b/linux/ecosystem/nginx/latest/mainline/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/latest/mainline/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/latest/mainline/main/requirements.txt b/linux/ecosystem/nginx/latest/mainline/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/latest/mainline/main/requirements.txt +++ b/linux/ecosystem/nginx/latest/mainline/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/latest/mainline/php/Makefile b/linux/ecosystem/nginx/latest/mainline/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/latest/mainline/php/Makefile +++ b/linux/ecosystem/nginx/latest/mainline/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/latest/mainline/php/kaniko-build.py b/linux/ecosystem/nginx/latest/mainline/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/latest/mainline/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/latest/mainline/php/requirements.txt b/linux/ecosystem/nginx/latest/mainline/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/latest/mainline/php/requirements.txt +++ b/linux/ecosystem/nginx/latest/mainline/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/latest/mainline/rtmp-hls/Makefile b/linux/ecosystem/nginx/latest/mainline/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/latest/mainline/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/latest/mainline/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/latest/mainline/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/latest/mainline/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/latest/mainline/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/latest/mainline/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/latest/mainline/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/latest/mainline/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/latest/mainline/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/latest/quic/main/Makefile b/linux/ecosystem/nginx/latest/quic/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/latest/quic/main/Makefile +++ b/linux/ecosystem/nginx/latest/quic/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/latest/quic/main/kaniko-build.py b/linux/ecosystem/nginx/latest/quic/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/latest/quic/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/latest/quic/main/requirements.txt b/linux/ecosystem/nginx/latest/quic/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/latest/quic/main/requirements.txt +++ b/linux/ecosystem/nginx/latest/quic/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/latest/quic/php/Makefile b/linux/ecosystem/nginx/latest/quic/php/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/latest/quic/php/Makefile +++ b/linux/ecosystem/nginx/latest/quic/php/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/latest/quic/php/kaniko-build.py b/linux/ecosystem/nginx/latest/quic/php/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/latest/quic/php/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/latest/quic/php/requirements.txt b/linux/ecosystem/nginx/latest/quic/php/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/latest/quic/php/requirements.txt +++ b/linux/ecosystem/nginx/latest/quic/php/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nginx/latest/quic/rtmp-hls/Makefile b/linux/ecosystem/nginx/latest/quic/rtmp-hls/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nginx/latest/quic/rtmp-hls/Makefile +++ b/linux/ecosystem/nginx/latest/quic/rtmp-hls/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nginx/latest/quic/rtmp-hls/kaniko-build.py b/linux/ecosystem/nginx/latest/quic/rtmp-hls/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nginx/latest/quic/rtmp-hls/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nginx/latest/quic/rtmp-hls/requirements.txt b/linux/ecosystem/nginx/latest/quic/rtmp-hls/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nginx/latest/quic/rtmp-hls/requirements.txt +++ b/linux/ecosystem/nginx/latest/quic/rtmp-hls/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/ninjam/latest/Makefile b/linux/ecosystem/ninjam/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/ninjam/latest/Makefile +++ b/linux/ecosystem/ninjam/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/ninjam/latest/kaniko-build.py b/linux/ecosystem/ninjam/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/ninjam/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/ninjam/latest/requirements.txt b/linux/ecosystem/ninjam/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/ninjam/latest/requirements.txt +++ b/linux/ecosystem/ninjam/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/current/Makefile b/linux/ecosystem/nodejs/current/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/current/Makefile +++ b/linux/ecosystem/nodejs/current/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/current/kaniko-build.py b/linux/ecosystem/nodejs/current/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/current/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/current/requirements.txt b/linux/ecosystem/nodejs/current/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/current/requirements.txt +++ b/linux/ecosystem/nodejs/current/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/lts/Makefile b/linux/ecosystem/nodejs/lts/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/lts/Makefile +++ b/linux/ecosystem/nodejs/lts/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/lts/kaniko-build.py b/linux/ecosystem/nodejs/lts/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/lts/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/lts/requirements.txt b/linux/ecosystem/nodejs/lts/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/lts/requirements.txt +++ b/linux/ecosystem/nodejs/lts/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node0.12/Makefile b/linux/ecosystem/nodejs/node0.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node0.12/Makefile +++ b/linux/ecosystem/nodejs/node0.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node0.12/kaniko-build.py b/linux/ecosystem/nodejs/node0.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node0.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node0.12/requirements.txt b/linux/ecosystem/nodejs/node0.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node0.12/requirements.txt +++ b/linux/ecosystem/nodejs/node0.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node10/Makefile b/linux/ecosystem/nodejs/node10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node10/Makefile +++ b/linux/ecosystem/nodejs/node10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node10/kaniko-build.py b/linux/ecosystem/nodejs/node10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node10/requirements.txt b/linux/ecosystem/nodejs/node10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node10/requirements.txt +++ b/linux/ecosystem/nodejs/node10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node11/Makefile b/linux/ecosystem/nodejs/node11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node11/Makefile +++ b/linux/ecosystem/nodejs/node11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node11/kaniko-build.py b/linux/ecosystem/nodejs/node11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node11/requirements.txt b/linux/ecosystem/nodejs/node11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node11/requirements.txt +++ b/linux/ecosystem/nodejs/node11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node12/Makefile b/linux/ecosystem/nodejs/node12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node12/Makefile +++ b/linux/ecosystem/nodejs/node12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node12/kaniko-build.py b/linux/ecosystem/nodejs/node12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node12/requirements.txt b/linux/ecosystem/nodejs/node12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node12/requirements.txt +++ b/linux/ecosystem/nodejs/node12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node13/Makefile b/linux/ecosystem/nodejs/node13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node13/Makefile +++ b/linux/ecosystem/nodejs/node13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node13/kaniko-build.py b/linux/ecosystem/nodejs/node13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node13/requirements.txt b/linux/ecosystem/nodejs/node13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node13/requirements.txt +++ b/linux/ecosystem/nodejs/node13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node14/Makefile b/linux/ecosystem/nodejs/node14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node14/Makefile +++ b/linux/ecosystem/nodejs/node14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node14/kaniko-build.py b/linux/ecosystem/nodejs/node14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node14/requirements.txt b/linux/ecosystem/nodejs/node14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node14/requirements.txt +++ b/linux/ecosystem/nodejs/node14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node15/Makefile b/linux/ecosystem/nodejs/node15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node15/Makefile +++ b/linux/ecosystem/nodejs/node15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node15/kaniko-build.py b/linux/ecosystem/nodejs/node15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node15/requirements.txt b/linux/ecosystem/nodejs/node15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node15/requirements.txt +++ b/linux/ecosystem/nodejs/node15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node16/Makefile b/linux/ecosystem/nodejs/node16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node16/Makefile +++ b/linux/ecosystem/nodejs/node16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node16/kaniko-build.py b/linux/ecosystem/nodejs/node16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node16/requirements.txt b/linux/ecosystem/nodejs/node16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node16/requirements.txt +++ b/linux/ecosystem/nodejs/node16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node17/Makefile b/linux/ecosystem/nodejs/node17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node17/Makefile +++ b/linux/ecosystem/nodejs/node17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node17/kaniko-build.py b/linux/ecosystem/nodejs/node17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node17/requirements.txt b/linux/ecosystem/nodejs/node17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node17/requirements.txt +++ b/linux/ecosystem/nodejs/node17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node18/Makefile b/linux/ecosystem/nodejs/node18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node18/Makefile +++ b/linux/ecosystem/nodejs/node18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node18/kaniko-build.py b/linux/ecosystem/nodejs/node18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node18/requirements.txt b/linux/ecosystem/nodejs/node18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node18/requirements.txt +++ b/linux/ecosystem/nodejs/node18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node19/Makefile b/linux/ecosystem/nodejs/node19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node19/Makefile +++ b/linux/ecosystem/nodejs/node19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node19/kaniko-build.py b/linux/ecosystem/nodejs/node19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node19/requirements.txt b/linux/ecosystem/nodejs/node19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node19/requirements.txt +++ b/linux/ecosystem/nodejs/node19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node20/Makefile b/linux/ecosystem/nodejs/node20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node20/Makefile +++ b/linux/ecosystem/nodejs/node20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node20/kaniko-build.py b/linux/ecosystem/nodejs/node20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node20/requirements.txt b/linux/ecosystem/nodejs/node20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node20/requirements.txt +++ b/linux/ecosystem/nodejs/node20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node21/Makefile b/linux/ecosystem/nodejs/node21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node21/Makefile +++ b/linux/ecosystem/nodejs/node21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node21/kaniko-build.py b/linux/ecosystem/nodejs/node21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node21/requirements.txt b/linux/ecosystem/nodejs/node21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node21/requirements.txt +++ b/linux/ecosystem/nodejs/node21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node22/Makefile b/linux/ecosystem/nodejs/node22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node22/Makefile +++ b/linux/ecosystem/nodejs/node22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node22/kaniko-build.py b/linux/ecosystem/nodejs/node22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node22/requirements.txt b/linux/ecosystem/nodejs/node22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node22/requirements.txt +++ b/linux/ecosystem/nodejs/node22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node4/Makefile b/linux/ecosystem/nodejs/node4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node4/Makefile +++ b/linux/ecosystem/nodejs/node4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node4/kaniko-build.py b/linux/ecosystem/nodejs/node4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node4/requirements.txt b/linux/ecosystem/nodejs/node4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node4/requirements.txt +++ b/linux/ecosystem/nodejs/node4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node5/Makefile b/linux/ecosystem/nodejs/node5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node5/Makefile +++ b/linux/ecosystem/nodejs/node5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node5/kaniko-build.py b/linux/ecosystem/nodejs/node5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node5/requirements.txt b/linux/ecosystem/nodejs/node5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node5/requirements.txt +++ b/linux/ecosystem/nodejs/node5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node6/Makefile b/linux/ecosystem/nodejs/node6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node6/Makefile +++ b/linux/ecosystem/nodejs/node6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node6/kaniko-build.py b/linux/ecosystem/nodejs/node6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node6/requirements.txt b/linux/ecosystem/nodejs/node6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node6/requirements.txt +++ b/linux/ecosystem/nodejs/node6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node7/Makefile b/linux/ecosystem/nodejs/node7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node7/Makefile +++ b/linux/ecosystem/nodejs/node7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node7/kaniko-build.py b/linux/ecosystem/nodejs/node7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node7/requirements.txt b/linux/ecosystem/nodejs/node7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node7/requirements.txt +++ b/linux/ecosystem/nodejs/node7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node8/Makefile b/linux/ecosystem/nodejs/node8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node8/Makefile +++ b/linux/ecosystem/nodejs/node8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node8/kaniko-build.py b/linux/ecosystem/nodejs/node8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node8/requirements.txt b/linux/ecosystem/nodejs/node8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node8/requirements.txt +++ b/linux/ecosystem/nodejs/node8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/nodejs/node9/Makefile b/linux/ecosystem/nodejs/node9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/nodejs/node9/Makefile +++ b/linux/ecosystem/nodejs/node9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/nodejs/node9/kaniko-build.py b/linux/ecosystem/nodejs/node9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/nodejs/node9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/nodejs/node9/requirements.txt b/linux/ecosystem/nodejs/node9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/nodejs/node9/requirements.txt +++ b/linux/ecosystem/nodejs/node9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/opentracker/Makefile b/linux/ecosystem/opentracker/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/opentracker/Makefile +++ b/linux/ecosystem/opentracker/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/opentracker/kaniko-build.py b/linux/ecosystem/opentracker/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/opentracker/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/opentracker/requirements.txt b/linux/ecosystem/opentracker/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/opentracker/requirements.txt +++ b/linux/ecosystem/opentracker/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r16.2/Makefile b/linux/ecosystem/perforce/base/r16.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r16.2/Makefile +++ b/linux/ecosystem/perforce/base/r16.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r16.2/kaniko-build.py b/linux/ecosystem/perforce/base/r16.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r16.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r16.2/requirements.txt b/linux/ecosystem/perforce/base/r16.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r16.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r16.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r17.1/Makefile b/linux/ecosystem/perforce/base/r17.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r17.1/Makefile +++ b/linux/ecosystem/perforce/base/r17.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r17.1/kaniko-build.py b/linux/ecosystem/perforce/base/r17.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r17.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r17.1/requirements.txt b/linux/ecosystem/perforce/base/r17.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r17.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r17.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r17.2/Makefile b/linux/ecosystem/perforce/base/r17.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r17.2/Makefile +++ b/linux/ecosystem/perforce/base/r17.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r17.2/kaniko-build.py b/linux/ecosystem/perforce/base/r17.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r17.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r17.2/requirements.txt b/linux/ecosystem/perforce/base/r17.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r17.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r17.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r18.1/Makefile b/linux/ecosystem/perforce/base/r18.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r18.1/Makefile +++ b/linux/ecosystem/perforce/base/r18.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r18.1/kaniko-build.py b/linux/ecosystem/perforce/base/r18.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r18.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r18.1/requirements.txt b/linux/ecosystem/perforce/base/r18.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r18.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r18.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r18.2/Makefile b/linux/ecosystem/perforce/base/r18.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r18.2/Makefile +++ b/linux/ecosystem/perforce/base/r18.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r18.2/kaniko-build.py b/linux/ecosystem/perforce/base/r18.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r18.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r18.2/requirements.txt b/linux/ecosystem/perforce/base/r18.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r18.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r18.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r19.1/Makefile b/linux/ecosystem/perforce/base/r19.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r19.1/Makefile +++ b/linux/ecosystem/perforce/base/r19.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r19.1/kaniko-build.py b/linux/ecosystem/perforce/base/r19.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r19.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r19.1/requirements.txt b/linux/ecosystem/perforce/base/r19.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r19.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r19.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r19.2/Makefile b/linux/ecosystem/perforce/base/r19.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r19.2/Makefile +++ b/linux/ecosystem/perforce/base/r19.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r19.2/kaniko-build.py b/linux/ecosystem/perforce/base/r19.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r19.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r19.2/requirements.txt b/linux/ecosystem/perforce/base/r19.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r19.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r19.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r20.1/Makefile b/linux/ecosystem/perforce/base/r20.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r20.1/Makefile +++ b/linux/ecosystem/perforce/base/r20.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r20.1/kaniko-build.py b/linux/ecosystem/perforce/base/r20.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r20.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r20.1/requirements.txt b/linux/ecosystem/perforce/base/r20.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r20.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r20.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r20.2/Makefile b/linux/ecosystem/perforce/base/r20.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r20.2/Makefile +++ b/linux/ecosystem/perforce/base/r20.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r20.2/kaniko-build.py b/linux/ecosystem/perforce/base/r20.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r20.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r20.2/requirements.txt b/linux/ecosystem/perforce/base/r20.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r20.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r20.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r21.1/Makefile b/linux/ecosystem/perforce/base/r21.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r21.1/Makefile +++ b/linux/ecosystem/perforce/base/r21.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r21.1/kaniko-build.py b/linux/ecosystem/perforce/base/r21.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r21.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r21.1/requirements.txt b/linux/ecosystem/perforce/base/r21.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r21.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r21.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r21.2/Makefile b/linux/ecosystem/perforce/base/r21.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r21.2/Makefile +++ b/linux/ecosystem/perforce/base/r21.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r21.2/kaniko-build.py b/linux/ecosystem/perforce/base/r21.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r21.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r21.2/requirements.txt b/linux/ecosystem/perforce/base/r21.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r21.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r21.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r22.1/Makefile b/linux/ecosystem/perforce/base/r22.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r22.1/Makefile +++ b/linux/ecosystem/perforce/base/r22.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r22.1/kaniko-build.py b/linux/ecosystem/perforce/base/r22.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r22.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r22.1/requirements.txt b/linux/ecosystem/perforce/base/r22.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r22.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r22.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r23.1/Makefile b/linux/ecosystem/perforce/base/r23.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r23.1/Makefile +++ b/linux/ecosystem/perforce/base/r23.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r23.1/kaniko-build.py b/linux/ecosystem/perforce/base/r23.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r23.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r23.1/requirements.txt b/linux/ecosystem/perforce/base/r23.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r23.1/requirements.txt +++ b/linux/ecosystem/perforce/base/r23.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/base/r23.2/Makefile b/linux/ecosystem/perforce/base/r23.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/base/r23.2/Makefile +++ b/linux/ecosystem/perforce/base/r23.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/base/r23.2/kaniko-build.py b/linux/ecosystem/perforce/base/r23.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/base/r23.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/base/r23.2/requirements.txt b/linux/ecosystem/perforce/base/r23.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/base/r23.2/requirements.txt +++ b/linux/ecosystem/perforce/base/r23.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r16.2/Makefile b/linux/ecosystem/perforce/p4p/r16.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r16.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r16.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r16.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r16.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r16.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r16.2/requirements.txt b/linux/ecosystem/perforce/p4p/r16.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r16.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r16.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r17.1/Makefile b/linux/ecosystem/perforce/p4p/r17.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r17.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r17.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r17.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r17.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r17.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r17.1/requirements.txt b/linux/ecosystem/perforce/p4p/r17.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r17.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r17.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r17.2/Makefile b/linux/ecosystem/perforce/p4p/r17.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r17.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r17.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r17.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r17.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r17.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r17.2/requirements.txt b/linux/ecosystem/perforce/p4p/r17.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r17.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r17.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r18.1/Makefile b/linux/ecosystem/perforce/p4p/r18.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r18.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r18.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r18.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r18.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r18.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r18.1/requirements.txt b/linux/ecosystem/perforce/p4p/r18.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r18.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r18.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r18.2/Makefile b/linux/ecosystem/perforce/p4p/r18.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r18.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r18.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r18.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r18.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r18.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r18.2/requirements.txt b/linux/ecosystem/perforce/p4p/r18.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r18.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r18.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r19.1/Makefile b/linux/ecosystem/perforce/p4p/r19.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r19.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r19.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r19.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r19.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r19.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r19.1/requirements.txt b/linux/ecosystem/perforce/p4p/r19.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r19.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r19.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r19.2/Makefile b/linux/ecosystem/perforce/p4p/r19.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r19.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r19.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r19.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r19.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r19.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r19.2/requirements.txt b/linux/ecosystem/perforce/p4p/r19.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r19.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r19.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r20.1/Makefile b/linux/ecosystem/perforce/p4p/r20.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r20.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r20.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r20.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r20.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r20.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r20.1/requirements.txt b/linux/ecosystem/perforce/p4p/r20.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r20.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r20.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r20.2/Makefile b/linux/ecosystem/perforce/p4p/r20.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r20.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r20.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r20.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r20.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r20.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r20.2/requirements.txt b/linux/ecosystem/perforce/p4p/r20.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r20.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r20.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r21.1/Makefile b/linux/ecosystem/perforce/p4p/r21.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r21.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r21.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r21.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r21.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r21.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r21.1/requirements.txt b/linux/ecosystem/perforce/p4p/r21.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r21.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r21.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r21.2/Makefile b/linux/ecosystem/perforce/p4p/r21.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r21.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r21.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r21.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r21.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r21.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r21.2/requirements.txt b/linux/ecosystem/perforce/p4p/r21.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r21.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r21.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r22.1/Makefile b/linux/ecosystem/perforce/p4p/r22.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r22.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r22.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r22.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r22.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r22.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r22.1/requirements.txt b/linux/ecosystem/perforce/p4p/r22.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r22.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r22.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r23.1/Makefile b/linux/ecosystem/perforce/p4p/r23.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r23.1/Makefile +++ b/linux/ecosystem/perforce/p4p/r23.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r23.1/kaniko-build.py b/linux/ecosystem/perforce/p4p/r23.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r23.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r23.1/requirements.txt b/linux/ecosystem/perforce/p4p/r23.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r23.1/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r23.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/perforce/p4p/r23.2/Makefile b/linux/ecosystem/perforce/p4p/r23.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/perforce/p4p/r23.2/Makefile +++ b/linux/ecosystem/perforce/p4p/r23.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/perforce/p4p/r23.2/kaniko-build.py b/linux/ecosystem/perforce/p4p/r23.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/perforce/p4p/r23.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/perforce/p4p/r23.2/requirements.txt b/linux/ecosystem/perforce/p4p/r23.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/perforce/p4p/r23.2/requirements.txt +++ b/linux/ecosystem/perforce/p4p/r23.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php5.5/Makefile b/linux/ecosystem/php/php5.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php5.5/Makefile +++ b/linux/ecosystem/php/php5.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php5.5/kaniko-build.py b/linux/ecosystem/php/php5.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php5.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php5.5/requirements.txt b/linux/ecosystem/php/php5.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php5.5/requirements.txt +++ b/linux/ecosystem/php/php5.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php7.0/Makefile b/linux/ecosystem/php/php7.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php7.0/Makefile +++ b/linux/ecosystem/php/php7.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php7.0/kaniko-build.py b/linux/ecosystem/php/php7.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php7.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php7.0/requirements.txt b/linux/ecosystem/php/php7.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php7.0/requirements.txt +++ b/linux/ecosystem/php/php7.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php7.1/Makefile b/linux/ecosystem/php/php7.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php7.1/Makefile +++ b/linux/ecosystem/php/php7.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php7.1/kaniko-build.py b/linux/ecosystem/php/php7.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php7.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php7.1/requirements.txt b/linux/ecosystem/php/php7.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php7.1/requirements.txt +++ b/linux/ecosystem/php/php7.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php7.2/Makefile b/linux/ecosystem/php/php7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php7.2/Makefile +++ b/linux/ecosystem/php/php7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php7.2/kaniko-build.py b/linux/ecosystem/php/php7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php7.2/requirements.txt b/linux/ecosystem/php/php7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php7.2/requirements.txt +++ b/linux/ecosystem/php/php7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php7.3/Makefile b/linux/ecosystem/php/php7.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php7.3/Makefile +++ b/linux/ecosystem/php/php7.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php7.3/kaniko-build.py b/linux/ecosystem/php/php7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php7.3/requirements.txt b/linux/ecosystem/php/php7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php7.3/requirements.txt +++ b/linux/ecosystem/php/php7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php7.4/Makefile b/linux/ecosystem/php/php7.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php7.4/Makefile +++ b/linux/ecosystem/php/php7.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php7.4/kaniko-build.py b/linux/ecosystem/php/php7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php7.4/requirements.txt b/linux/ecosystem/php/php7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php7.4/requirements.txt +++ b/linux/ecosystem/php/php7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php8.0/Makefile b/linux/ecosystem/php/php8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php8.0/Makefile +++ b/linux/ecosystem/php/php8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php8.0/kaniko-build.py b/linux/ecosystem/php/php8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php8.0/requirements.txt b/linux/ecosystem/php/php8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php8.0/requirements.txt +++ b/linux/ecosystem/php/php8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php8.1/Makefile b/linux/ecosystem/php/php8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php8.1/Makefile +++ b/linux/ecosystem/php/php8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php8.1/kaniko-build.py b/linux/ecosystem/php/php8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php8.1/requirements.txt b/linux/ecosystem/php/php8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php8.1/requirements.txt +++ b/linux/ecosystem/php/php8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php8.2/Makefile b/linux/ecosystem/php/php8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php8.2/Makefile +++ b/linux/ecosystem/php/php8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php8.2/kaniko-build.py b/linux/ecosystem/php/php8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php8.2/requirements.txt b/linux/ecosystem/php/php8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php8.2/requirements.txt +++ b/linux/ecosystem/php/php8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/php/php8.3/Makefile b/linux/ecosystem/php/php8.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/php/php8.3/Makefile +++ b/linux/ecosystem/php/php8.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/php/php8.3/kaniko-build.py b/linux/ecosystem/php/php8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/php/php8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/php/php8.3/requirements.txt b/linux/ecosystem/php/php8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/php/php8.3/requirements.txt +++ b/linux/ecosystem/php/php8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/10/Makefile b/linux/ecosystem/postgres/10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/10/Makefile +++ b/linux/ecosystem/postgres/10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/10/kaniko-build.py b/linux/ecosystem/postgres/10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/10/requirements.txt b/linux/ecosystem/postgres/10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/10/requirements.txt +++ b/linux/ecosystem/postgres/10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/11/Makefile b/linux/ecosystem/postgres/11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/11/Makefile +++ b/linux/ecosystem/postgres/11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/11/kaniko-build.py b/linux/ecosystem/postgres/11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/11/requirements.txt b/linux/ecosystem/postgres/11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/11/requirements.txt +++ b/linux/ecosystem/postgres/11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/12/Makefile b/linux/ecosystem/postgres/12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/12/Makefile +++ b/linux/ecosystem/postgres/12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/12/kaniko-build.py b/linux/ecosystem/postgres/12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/12/requirements.txt b/linux/ecosystem/postgres/12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/12/requirements.txt +++ b/linux/ecosystem/postgres/12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/13/Makefile b/linux/ecosystem/postgres/13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/13/Makefile +++ b/linux/ecosystem/postgres/13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/13/kaniko-build.py b/linux/ecosystem/postgres/13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/13/requirements.txt b/linux/ecosystem/postgres/13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/13/requirements.txt +++ b/linux/ecosystem/postgres/13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/14/Makefile b/linux/ecosystem/postgres/14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/14/Makefile +++ b/linux/ecosystem/postgres/14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/14/kaniko-build.py b/linux/ecosystem/postgres/14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/14/requirements.txt b/linux/ecosystem/postgres/14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/14/requirements.txt +++ b/linux/ecosystem/postgres/14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/15/Makefile b/linux/ecosystem/postgres/15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/15/Makefile +++ b/linux/ecosystem/postgres/15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/15/kaniko-build.py b/linux/ecosystem/postgres/15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/15/requirements.txt b/linux/ecosystem/postgres/15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/15/requirements.txt +++ b/linux/ecosystem/postgres/15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/16/Makefile b/linux/ecosystem/postgres/16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/16/Makefile +++ b/linux/ecosystem/postgres/16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/16/kaniko-build.py b/linux/ecosystem/postgres/16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/16/requirements.txt b/linux/ecosystem/postgres/16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/16/requirements.txt +++ b/linux/ecosystem/postgres/16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/8.2/Makefile b/linux/ecosystem/postgres/8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/8.2/Makefile +++ b/linux/ecosystem/postgres/8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/8.2/kaniko-build.py b/linux/ecosystem/postgres/8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/8.2/requirements.txt b/linux/ecosystem/postgres/8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/8.2/requirements.txt +++ b/linux/ecosystem/postgres/8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/8.3/Makefile b/linux/ecosystem/postgres/8.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/8.3/Makefile +++ b/linux/ecosystem/postgres/8.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/8.3/kaniko-build.py b/linux/ecosystem/postgres/8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/8.3/requirements.txt b/linux/ecosystem/postgres/8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/8.3/requirements.txt +++ b/linux/ecosystem/postgres/8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/8.4/Makefile b/linux/ecosystem/postgres/8.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/8.4/Makefile +++ b/linux/ecosystem/postgres/8.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/8.4/kaniko-build.py b/linux/ecosystem/postgres/8.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/8.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/8.4/requirements.txt b/linux/ecosystem/postgres/8.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/8.4/requirements.txt +++ b/linux/ecosystem/postgres/8.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.0/Makefile b/linux/ecosystem/postgres/9.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.0/Makefile +++ b/linux/ecosystem/postgres/9.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.0/kaniko-build.py b/linux/ecosystem/postgres/9.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.0/requirements.txt b/linux/ecosystem/postgres/9.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.0/requirements.txt +++ b/linux/ecosystem/postgres/9.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.1/Makefile b/linux/ecosystem/postgres/9.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.1/Makefile +++ b/linux/ecosystem/postgres/9.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.1/kaniko-build.py b/linux/ecosystem/postgres/9.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.1/requirements.txt b/linux/ecosystem/postgres/9.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.1/requirements.txt +++ b/linux/ecosystem/postgres/9.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.2/Makefile b/linux/ecosystem/postgres/9.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.2/Makefile +++ b/linux/ecosystem/postgres/9.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.2/kaniko-build.py b/linux/ecosystem/postgres/9.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.2/requirements.txt b/linux/ecosystem/postgres/9.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.2/requirements.txt +++ b/linux/ecosystem/postgres/9.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.3/Makefile b/linux/ecosystem/postgres/9.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.3/Makefile +++ b/linux/ecosystem/postgres/9.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.3/kaniko-build.py b/linux/ecosystem/postgres/9.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.3/requirements.txt b/linux/ecosystem/postgres/9.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.3/requirements.txt +++ b/linux/ecosystem/postgres/9.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.4/Makefile b/linux/ecosystem/postgres/9.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.4/Makefile +++ b/linux/ecosystem/postgres/9.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.4/kaniko-build.py b/linux/ecosystem/postgres/9.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.4/requirements.txt b/linux/ecosystem/postgres/9.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.4/requirements.txt +++ b/linux/ecosystem/postgres/9.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.5/Makefile b/linux/ecosystem/postgres/9.5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.5/Makefile +++ b/linux/ecosystem/postgres/9.5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.5/kaniko-build.py b/linux/ecosystem/postgres/9.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.5/requirements.txt b/linux/ecosystem/postgres/9.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.5/requirements.txt +++ b/linux/ecosystem/postgres/9.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/9.6/Makefile b/linux/ecosystem/postgres/9.6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/9.6/Makefile +++ b/linux/ecosystem/postgres/9.6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/9.6/kaniko-build.py b/linux/ecosystem/postgres/9.6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/9.6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/9.6/requirements.txt b/linux/ecosystem/postgres/9.6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/9.6/requirements.txt +++ b/linux/ecosystem/postgres/9.6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/postgres/latest/Makefile b/linux/ecosystem/postgres/latest/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/postgres/latest/Makefile +++ b/linux/ecosystem/postgres/latest/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/postgres/latest/kaniko-build.py b/linux/ecosystem/postgres/latest/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/postgres/latest/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/postgres/latest/requirements.txt b/linux/ecosystem/postgres/latest/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/postgres/latest/requirements.txt +++ b/linux/ecosystem/postgres/latest/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.4.0/Makefile b/linux/ecosystem/qbittorrent/4.4.0/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.4.0/Makefile +++ b/linux/ecosystem/qbittorrent/4.4.0/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.4.0/kaniko-build.py b/linux/ecosystem/qbittorrent/4.4.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.4.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.4.0/requirements.txt b/linux/ecosystem/qbittorrent/4.4.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.4.0/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.4.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.4.1/Makefile b/linux/ecosystem/qbittorrent/4.4.1/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.4.1/Makefile +++ b/linux/ecosystem/qbittorrent/4.4.1/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.4.1/kaniko-build.py b/linux/ecosystem/qbittorrent/4.4.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.4.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.4.1/requirements.txt b/linux/ecosystem/qbittorrent/4.4.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.4.1/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.4.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.4.2/Makefile b/linux/ecosystem/qbittorrent/4.4.2/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.4.2/Makefile +++ b/linux/ecosystem/qbittorrent/4.4.2/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.4.2/kaniko-build.py b/linux/ecosystem/qbittorrent/4.4.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.4.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.4.2/requirements.txt b/linux/ecosystem/qbittorrent/4.4.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.4.2/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.4.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.4.3.1/Makefile b/linux/ecosystem/qbittorrent/4.4.3.1/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.4.3.1/Makefile +++ b/linux/ecosystem/qbittorrent/4.4.3.1/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.4.3.1/kaniko-build.py b/linux/ecosystem/qbittorrent/4.4.3.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.4.3.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.4.3.1/requirements.txt b/linux/ecosystem/qbittorrent/4.4.3.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.4.3.1/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.4.3.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.4.4/Makefile b/linux/ecosystem/qbittorrent/4.4.4/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.4.4/Makefile +++ b/linux/ecosystem/qbittorrent/4.4.4/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.4.4/kaniko-build.py b/linux/ecosystem/qbittorrent/4.4.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.4.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.4.4/requirements.txt b/linux/ecosystem/qbittorrent/4.4.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.4.4/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.4.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.4.5/Makefile b/linux/ecosystem/qbittorrent/4.4.5/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.4.5/Makefile +++ b/linux/ecosystem/qbittorrent/4.4.5/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.4.5/kaniko-build.py b/linux/ecosystem/qbittorrent/4.4.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.4.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.4.5/requirements.txt b/linux/ecosystem/qbittorrent/4.4.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.4.5/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.4.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.5.0/Makefile b/linux/ecosystem/qbittorrent/4.5.0/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.5.0/Makefile +++ b/linux/ecosystem/qbittorrent/4.5.0/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.5.0/kaniko-build.py b/linux/ecosystem/qbittorrent/4.5.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.5.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.5.0/requirements.txt b/linux/ecosystem/qbittorrent/4.5.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.5.0/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.5.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.5.1/Makefile b/linux/ecosystem/qbittorrent/4.5.1/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.5.1/Makefile +++ b/linux/ecosystem/qbittorrent/4.5.1/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.5.1/kaniko-build.py b/linux/ecosystem/qbittorrent/4.5.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.5.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.5.1/requirements.txt b/linux/ecosystem/qbittorrent/4.5.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.5.1/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.5.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.5.2/Makefile b/linux/ecosystem/qbittorrent/4.5.2/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.5.2/Makefile +++ b/linux/ecosystem/qbittorrent/4.5.2/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.5.2/kaniko-build.py b/linux/ecosystem/qbittorrent/4.5.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.5.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.5.2/requirements.txt b/linux/ecosystem/qbittorrent/4.5.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.5.2/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.5.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.5.3/Makefile b/linux/ecosystem/qbittorrent/4.5.3/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.5.3/Makefile +++ b/linux/ecosystem/qbittorrent/4.5.3/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.5.3/kaniko-build.py b/linux/ecosystem/qbittorrent/4.5.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.5.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.5.3/requirements.txt b/linux/ecosystem/qbittorrent/4.5.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.5.3/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.5.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.5.4/Makefile b/linux/ecosystem/qbittorrent/4.5.4/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.5.4/Makefile +++ b/linux/ecosystem/qbittorrent/4.5.4/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.5.4/kaniko-build.py b/linux/ecosystem/qbittorrent/4.5.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.5.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.5.4/requirements.txt b/linux/ecosystem/qbittorrent/4.5.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.5.4/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.5.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.5.5/Makefile b/linux/ecosystem/qbittorrent/4.5.5/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.5.5/Makefile +++ b/linux/ecosystem/qbittorrent/4.5.5/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.5.5/kaniko-build.py b/linux/ecosystem/qbittorrent/4.5.5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.5.5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.5.5/requirements.txt b/linux/ecosystem/qbittorrent/4.5.5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.5.5/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.5.5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.6.0/Makefile b/linux/ecosystem/qbittorrent/4.6.0/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.6.0/Makefile +++ b/linux/ecosystem/qbittorrent/4.6.0/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.6.0/kaniko-build.py b/linux/ecosystem/qbittorrent/4.6.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.6.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.6.0/requirements.txt b/linux/ecosystem/qbittorrent/4.6.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.6.0/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.6.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.6.1/Makefile b/linux/ecosystem/qbittorrent/4.6.1/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.6.1/Makefile +++ b/linux/ecosystem/qbittorrent/4.6.1/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.6.1/kaniko-build.py b/linux/ecosystem/qbittorrent/4.6.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.6.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.6.1/requirements.txt b/linux/ecosystem/qbittorrent/4.6.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.6.1/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.6.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.6.2/Makefile b/linux/ecosystem/qbittorrent/4.6.2/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.6.2/Makefile +++ b/linux/ecosystem/qbittorrent/4.6.2/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.6.2/kaniko-build.py b/linux/ecosystem/qbittorrent/4.6.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.6.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.6.2/requirements.txt b/linux/ecosystem/qbittorrent/4.6.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.6.2/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.6.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.6.3/Makefile b/linux/ecosystem/qbittorrent/4.6.3/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.6.3/Makefile +++ b/linux/ecosystem/qbittorrent/4.6.3/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.6.3/kaniko-build.py b/linux/ecosystem/qbittorrent/4.6.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.6.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.6.3/requirements.txt b/linux/ecosystem/qbittorrent/4.6.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.6.3/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.6.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/4.6.4/Makefile b/linux/ecosystem/qbittorrent/4.6.4/Makefile index 3f22f2b23..b1930a89e 100644 --- a/linux/ecosystem/qbittorrent/4.6.4/Makefile +++ b/linux/ecosystem/qbittorrent/4.6.4/Makefile @@ -14,7 +14,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/4.6.4/kaniko-build.py b/linux/ecosystem/qbittorrent/4.6.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/4.6.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/4.6.4/requirements.txt b/linux/ecosystem/qbittorrent/4.6.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/4.6.4/requirements.txt +++ b/linux/ecosystem/qbittorrent/4.6.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/qbittorrent/testing/Makefile b/linux/ecosystem/qbittorrent/testing/Makefile index fb4042172..e9d386ab2 100644 --- a/linux/ecosystem/qbittorrent/testing/Makefile +++ b/linux/ecosystem/qbittorrent/testing/Makefile @@ -13,7 +13,7 @@ build: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/qbittorrent/testing/kaniko-build.py b/linux/ecosystem/qbittorrent/testing/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/qbittorrent/testing/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/qbittorrent/testing/requirements.txt b/linux/ecosystem/qbittorrent/testing/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/qbittorrent/testing/requirements.txt +++ b/linux/ecosystem/qbittorrent/testing/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/retracker/Makefile b/linux/ecosystem/retracker/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/retracker/Makefile +++ b/linux/ecosystem/retracker/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/retracker/kaniko-build.py b/linux/ecosystem/retracker/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/retracker/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/retracker/requirements.txt b/linux/ecosystem/retracker/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/retracker/requirements.txt +++ b/linux/ecosystem/retracker/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/Makefile b/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/Makefile +++ b/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/kaniko-build.py b/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/requirements.txt b/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/requirements.txt +++ b/linux/ecosystem/teamcity/agent/amxx-sdk/1.10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/Makefile b/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/Makefile +++ b/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/kaniko-build.py b/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/requirements.txt b/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/requirements.txt +++ b/linux/ecosystem/teamcity/agent/amxx-sdk/1.9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk11/Makefile b/linux/ecosystem/teamcity/agent/android-sdk/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk11/Makefile +++ b/linux/ecosystem/teamcity/agent/android-sdk/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk11/kaniko-build.py b/linux/ecosystem/teamcity/agent/android-sdk/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk11/requirements.txt b/linux/ecosystem/teamcity/agent/android-sdk/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk11/requirements.txt +++ b/linux/ecosystem/teamcity/agent/android-sdk/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk17/Makefile b/linux/ecosystem/teamcity/agent/android-sdk/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk17/Makefile +++ b/linux/ecosystem/teamcity/agent/android-sdk/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk17/kaniko-build.py b/linux/ecosystem/teamcity/agent/android-sdk/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk17/requirements.txt b/linux/ecosystem/teamcity/agent/android-sdk/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk17/requirements.txt +++ b/linux/ecosystem/teamcity/agent/android-sdk/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk8/Makefile b/linux/ecosystem/teamcity/agent/android-sdk/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk8/Makefile +++ b/linux/ecosystem/teamcity/agent/android-sdk/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk8/kaniko-build.py b/linux/ecosystem/teamcity/agent/android-sdk/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/android-sdk/jdk8/requirements.txt b/linux/ecosystem/teamcity/agent/android-sdk/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/android-sdk/jdk8/requirements.txt +++ b/linux/ecosystem/teamcity/agent/android-sdk/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/atlassian-sdk/Makefile b/linux/ecosystem/teamcity/agent/atlassian-sdk/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/atlassian-sdk/Makefile +++ b/linux/ecosystem/teamcity/agent/atlassian-sdk/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/atlassian-sdk/kaniko-build.py b/linux/ecosystem/teamcity/agent/atlassian-sdk/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/atlassian-sdk/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/atlassian-sdk/requirements.txt b/linux/ecosystem/teamcity/agent/atlassian-sdk/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/atlassian-sdk/requirements.txt +++ b/linux/ecosystem/teamcity/agent/atlassian-sdk/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/dotnet-sdk/Makefile b/linux/ecosystem/teamcity/agent/dotnet-sdk/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/dotnet-sdk/Makefile +++ b/linux/ecosystem/teamcity/agent/dotnet-sdk/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/dotnet-sdk/kaniko-build.py b/linux/ecosystem/teamcity/agent/dotnet-sdk/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/dotnet-sdk/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/dotnet-sdk/requirements.txt b/linux/ecosystem/teamcity/agent/dotnet-sdk/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/dotnet-sdk/requirements.txt +++ b/linux/ecosystem/teamcity/agent/dotnet-sdk/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/latest/jdk11/Makefile b/linux/ecosystem/teamcity/agent/latest/jdk11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk11/Makefile +++ b/linux/ecosystem/teamcity/agent/latest/jdk11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/latest/jdk11/kaniko-build.py b/linux/ecosystem/teamcity/agent/latest/jdk11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/latest/jdk11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/latest/jdk11/requirements.txt b/linux/ecosystem/teamcity/agent/latest/jdk11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk11/requirements.txt +++ b/linux/ecosystem/teamcity/agent/latest/jdk11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/latest/jdk17/Makefile b/linux/ecosystem/teamcity/agent/latest/jdk17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk17/Makefile +++ b/linux/ecosystem/teamcity/agent/latest/jdk17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/latest/jdk17/kaniko-build.py b/linux/ecosystem/teamcity/agent/latest/jdk17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/latest/jdk17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/latest/jdk17/requirements.txt b/linux/ecosystem/teamcity/agent/latest/jdk17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk17/requirements.txt +++ b/linux/ecosystem/teamcity/agent/latest/jdk17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/latest/jdk21/Makefile b/linux/ecosystem/teamcity/agent/latest/jdk21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk21/Makefile +++ b/linux/ecosystem/teamcity/agent/latest/jdk21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/latest/jdk21/kaniko-build.py b/linux/ecosystem/teamcity/agent/latest/jdk21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/latest/jdk21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/latest/jdk21/requirements.txt b/linux/ecosystem/teamcity/agent/latest/jdk21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk21/requirements.txt +++ b/linux/ecosystem/teamcity/agent/latest/jdk21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/latest/jdk8/Makefile b/linux/ecosystem/teamcity/agent/latest/jdk8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk8/Makefile +++ b/linux/ecosystem/teamcity/agent/latest/jdk8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/latest/jdk8/kaniko-build.py b/linux/ecosystem/teamcity/agent/latest/jdk8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/latest/jdk8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/latest/jdk8/requirements.txt b/linux/ecosystem/teamcity/agent/latest/jdk8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/latest/jdk8/requirements.txt +++ b/linux/ecosystem/teamcity/agent/latest/jdk8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node0.12/Makefile b/linux/ecosystem/teamcity/agent/node0.12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node0.12/Makefile +++ b/linux/ecosystem/teamcity/agent/node0.12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node0.12/kaniko-build.py b/linux/ecosystem/teamcity/agent/node0.12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node0.12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node0.12/requirements.txt b/linux/ecosystem/teamcity/agent/node0.12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node0.12/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node0.12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node10/Makefile b/linux/ecosystem/teamcity/agent/node10/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node10/Makefile +++ b/linux/ecosystem/teamcity/agent/node10/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node10/kaniko-build.py b/linux/ecosystem/teamcity/agent/node10/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node10/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node10/requirements.txt b/linux/ecosystem/teamcity/agent/node10/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node10/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node10/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node11/Makefile b/linux/ecosystem/teamcity/agent/node11/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node11/Makefile +++ b/linux/ecosystem/teamcity/agent/node11/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node11/kaniko-build.py b/linux/ecosystem/teamcity/agent/node11/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node11/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node11/requirements.txt b/linux/ecosystem/teamcity/agent/node11/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node11/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node11/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node12/Makefile b/linux/ecosystem/teamcity/agent/node12/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node12/Makefile +++ b/linux/ecosystem/teamcity/agent/node12/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node12/kaniko-build.py b/linux/ecosystem/teamcity/agent/node12/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node12/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node12/requirements.txt b/linux/ecosystem/teamcity/agent/node12/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node12/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node12/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node13/Makefile b/linux/ecosystem/teamcity/agent/node13/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node13/Makefile +++ b/linux/ecosystem/teamcity/agent/node13/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node13/kaniko-build.py b/linux/ecosystem/teamcity/agent/node13/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node13/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node13/requirements.txt b/linux/ecosystem/teamcity/agent/node13/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node13/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node13/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node14/Makefile b/linux/ecosystem/teamcity/agent/node14/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node14/Makefile +++ b/linux/ecosystem/teamcity/agent/node14/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node14/kaniko-build.py b/linux/ecosystem/teamcity/agent/node14/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node14/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node14/requirements.txt b/linux/ecosystem/teamcity/agent/node14/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node14/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node14/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node15/Makefile b/linux/ecosystem/teamcity/agent/node15/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node15/Makefile +++ b/linux/ecosystem/teamcity/agent/node15/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node15/kaniko-build.py b/linux/ecosystem/teamcity/agent/node15/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node15/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node15/requirements.txt b/linux/ecosystem/teamcity/agent/node15/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node15/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node15/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node16/Makefile b/linux/ecosystem/teamcity/agent/node16/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node16/Makefile +++ b/linux/ecosystem/teamcity/agent/node16/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node16/kaniko-build.py b/linux/ecosystem/teamcity/agent/node16/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node16/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node16/requirements.txt b/linux/ecosystem/teamcity/agent/node16/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node16/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node16/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node17/Makefile b/linux/ecosystem/teamcity/agent/node17/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node17/Makefile +++ b/linux/ecosystem/teamcity/agent/node17/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node17/kaniko-build.py b/linux/ecosystem/teamcity/agent/node17/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node17/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node17/requirements.txt b/linux/ecosystem/teamcity/agent/node17/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node17/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node17/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node18/Makefile b/linux/ecosystem/teamcity/agent/node18/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node18/Makefile +++ b/linux/ecosystem/teamcity/agent/node18/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node18/kaniko-build.py b/linux/ecosystem/teamcity/agent/node18/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node18/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node18/requirements.txt b/linux/ecosystem/teamcity/agent/node18/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node18/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node18/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node19/Makefile b/linux/ecosystem/teamcity/agent/node19/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node19/Makefile +++ b/linux/ecosystem/teamcity/agent/node19/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node19/kaniko-build.py b/linux/ecosystem/teamcity/agent/node19/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node19/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node19/requirements.txt b/linux/ecosystem/teamcity/agent/node19/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node19/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node19/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node20/Makefile b/linux/ecosystem/teamcity/agent/node20/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node20/Makefile +++ b/linux/ecosystem/teamcity/agent/node20/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node20/kaniko-build.py b/linux/ecosystem/teamcity/agent/node20/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node20/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node20/requirements.txt b/linux/ecosystem/teamcity/agent/node20/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node20/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node20/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node21/Makefile b/linux/ecosystem/teamcity/agent/node21/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node21/Makefile +++ b/linux/ecosystem/teamcity/agent/node21/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node21/kaniko-build.py b/linux/ecosystem/teamcity/agent/node21/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node21/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node21/requirements.txt b/linux/ecosystem/teamcity/agent/node21/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node21/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node21/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node22/Makefile b/linux/ecosystem/teamcity/agent/node22/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node22/Makefile +++ b/linux/ecosystem/teamcity/agent/node22/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node22/kaniko-build.py b/linux/ecosystem/teamcity/agent/node22/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node22/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node22/requirements.txt b/linux/ecosystem/teamcity/agent/node22/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node22/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node22/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node4/Makefile b/linux/ecosystem/teamcity/agent/node4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node4/Makefile +++ b/linux/ecosystem/teamcity/agent/node4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node4/kaniko-build.py b/linux/ecosystem/teamcity/agent/node4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node4/requirements.txt b/linux/ecosystem/teamcity/agent/node4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node4/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node5/Makefile b/linux/ecosystem/teamcity/agent/node5/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node5/Makefile +++ b/linux/ecosystem/teamcity/agent/node5/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node5/kaniko-build.py b/linux/ecosystem/teamcity/agent/node5/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node5/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node5/requirements.txt b/linux/ecosystem/teamcity/agent/node5/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node5/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node5/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node6/Makefile b/linux/ecosystem/teamcity/agent/node6/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node6/Makefile +++ b/linux/ecosystem/teamcity/agent/node6/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node6/kaniko-build.py b/linux/ecosystem/teamcity/agent/node6/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node6/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node6/requirements.txt b/linux/ecosystem/teamcity/agent/node6/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node6/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node6/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node7/Makefile b/linux/ecosystem/teamcity/agent/node7/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node7/Makefile +++ b/linux/ecosystem/teamcity/agent/node7/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node7/kaniko-build.py b/linux/ecosystem/teamcity/agent/node7/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node7/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node7/requirements.txt b/linux/ecosystem/teamcity/agent/node7/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node7/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node7/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node8/Makefile b/linux/ecosystem/teamcity/agent/node8/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node8/Makefile +++ b/linux/ecosystem/teamcity/agent/node8/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node8/kaniko-build.py b/linux/ecosystem/teamcity/agent/node8/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node8/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node8/requirements.txt b/linux/ecosystem/teamcity/agent/node8/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node8/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node8/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/node9/Makefile b/linux/ecosystem/teamcity/agent/node9/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/node9/Makefile +++ b/linux/ecosystem/teamcity/agent/node9/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/node9/kaniko-build.py b/linux/ecosystem/teamcity/agent/node9/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/node9/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/node9/requirements.txt b/linux/ecosystem/teamcity/agent/node9/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/node9/requirements.txt +++ b/linux/ecosystem/teamcity/agent/node9/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php7.2/Makefile b/linux/ecosystem/teamcity/agent/php7.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php7.2/Makefile +++ b/linux/ecosystem/teamcity/agent/php7.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php7.2/kaniko-build.py b/linux/ecosystem/teamcity/agent/php7.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php7.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php7.2/requirements.txt b/linux/ecosystem/teamcity/agent/php7.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php7.2/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php7.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php7.3/Makefile b/linux/ecosystem/teamcity/agent/php7.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php7.3/Makefile +++ b/linux/ecosystem/teamcity/agent/php7.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php7.3/kaniko-build.py b/linux/ecosystem/teamcity/agent/php7.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php7.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php7.3/requirements.txt b/linux/ecosystem/teamcity/agent/php7.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php7.3/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php7.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php7.4/Makefile b/linux/ecosystem/teamcity/agent/php7.4/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php7.4/Makefile +++ b/linux/ecosystem/teamcity/agent/php7.4/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php7.4/kaniko-build.py b/linux/ecosystem/teamcity/agent/php7.4/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php7.4/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php7.4/requirements.txt b/linux/ecosystem/teamcity/agent/php7.4/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php7.4/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php7.4/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php8.0/Makefile b/linux/ecosystem/teamcity/agent/php8.0/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php8.0/Makefile +++ b/linux/ecosystem/teamcity/agent/php8.0/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php8.0/kaniko-build.py b/linux/ecosystem/teamcity/agent/php8.0/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php8.0/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php8.0/requirements.txt b/linux/ecosystem/teamcity/agent/php8.0/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php8.0/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php8.0/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php8.1/Makefile b/linux/ecosystem/teamcity/agent/php8.1/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php8.1/Makefile +++ b/linux/ecosystem/teamcity/agent/php8.1/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php8.1/kaniko-build.py b/linux/ecosystem/teamcity/agent/php8.1/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php8.1/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php8.1/requirements.txt b/linux/ecosystem/teamcity/agent/php8.1/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php8.1/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php8.1/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php8.2/Makefile b/linux/ecosystem/teamcity/agent/php8.2/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php8.2/Makefile +++ b/linux/ecosystem/teamcity/agent/php8.2/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php8.2/kaniko-build.py b/linux/ecosystem/teamcity/agent/php8.2/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php8.2/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php8.2/requirements.txt b/linux/ecosystem/teamcity/agent/php8.2/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php8.2/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php8.2/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/php8.3/Makefile b/linux/ecosystem/teamcity/agent/php8.3/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/php8.3/Makefile +++ b/linux/ecosystem/teamcity/agent/php8.3/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/php8.3/kaniko-build.py b/linux/ecosystem/teamcity/agent/php8.3/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/php8.3/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/php8.3/requirements.txt b/linux/ecosystem/teamcity/agent/php8.3/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/php8.3/requirements.txt +++ b/linux/ecosystem/teamcity/agent/php8.3/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/teamcity/agent/steam-sdk/Makefile b/linux/ecosystem/teamcity/agent/steam-sdk/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/teamcity/agent/steam-sdk/Makefile +++ b/linux/ecosystem/teamcity/agent/steam-sdk/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/teamcity/agent/steam-sdk/kaniko-build.py b/linux/ecosystem/teamcity/agent/steam-sdk/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/teamcity/agent/steam-sdk/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/teamcity/agent/steam-sdk/requirements.txt b/linux/ecosystem/teamcity/agent/steam-sdk/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/teamcity/agent/steam-sdk/requirements.txt +++ b/linux/ecosystem/teamcity/agent/steam-sdk/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.4.1.3669/ad/Makefile b/linux/ecosystem/testrail/5.4.1.3669/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.4.1.3669/ad/Makefile +++ b/linux/ecosystem/testrail/5.4.1.3669/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.4.1.3669/ad/kaniko-build.py b/linux/ecosystem/testrail/5.4.1.3669/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.4.1.3669/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.4.1.3669/ad/requirements.txt b/linux/ecosystem/testrail/5.4.1.3669/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.4.1.3669/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.4.1.3669/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.4.1.3669/ldap/Makefile b/linux/ecosystem/testrail/5.4.1.3669/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.4.1.3669/ldap/Makefile +++ b/linux/ecosystem/testrail/5.4.1.3669/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.4.1.3669/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.4.1.3669/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.4.1.3669/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.4.1.3669/ldap/requirements.txt b/linux/ecosystem/testrail/5.4.1.3669/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.4.1.3669/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.4.1.3669/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.4.1.3669/main/Makefile b/linux/ecosystem/testrail/5.4.1.3669/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.4.1.3669/main/Makefile +++ b/linux/ecosystem/testrail/5.4.1.3669/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.4.1.3669/main/kaniko-build.py b/linux/ecosystem/testrail/5.4.1.3669/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.4.1.3669/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.4.1.3669/main/requirements.txt b/linux/ecosystem/testrail/5.4.1.3669/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.4.1.3669/main/requirements.txt +++ b/linux/ecosystem/testrail/5.4.1.3669/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3727/ad/Makefile b/linux/ecosystem/testrail/5.5.0.3727/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3727/ad/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3727/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3727/ad/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3727/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3727/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3727/ad/requirements.txt b/linux/ecosystem/testrail/5.5.0.3727/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3727/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3727/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3727/ldap/Makefile b/linux/ecosystem/testrail/5.5.0.3727/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3727/ldap/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3727/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3727/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3727/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3727/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3727/ldap/requirements.txt b/linux/ecosystem/testrail/5.5.0.3727/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3727/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3727/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3727/main/Makefile b/linux/ecosystem/testrail/5.5.0.3727/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3727/main/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3727/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3727/main/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3727/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3727/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3727/main/requirements.txt b/linux/ecosystem/testrail/5.5.0.3727/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3727/main/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3727/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3731/ad/Makefile b/linux/ecosystem/testrail/5.5.0.3731/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3731/ad/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3731/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3731/ad/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3731/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3731/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3731/ad/requirements.txt b/linux/ecosystem/testrail/5.5.0.3731/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3731/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3731/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3731/ldap/Makefile b/linux/ecosystem/testrail/5.5.0.3731/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3731/ldap/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3731/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3731/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3731/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3731/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3731/ldap/requirements.txt b/linux/ecosystem/testrail/5.5.0.3731/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3731/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3731/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3731/main/Makefile b/linux/ecosystem/testrail/5.5.0.3731/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3731/main/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3731/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3731/main/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3731/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3731/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3731/main/requirements.txt b/linux/ecosystem/testrail/5.5.0.3731/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3731/main/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3731/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3735/ad/Makefile b/linux/ecosystem/testrail/5.5.0.3735/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3735/ad/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3735/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3735/ad/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3735/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3735/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3735/ad/requirements.txt b/linux/ecosystem/testrail/5.5.0.3735/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3735/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3735/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3735/ldap/Makefile b/linux/ecosystem/testrail/5.5.0.3735/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3735/ldap/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3735/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3735/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3735/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3735/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3735/ldap/requirements.txt b/linux/ecosystem/testrail/5.5.0.3735/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3735/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3735/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.0.3735/main/Makefile b/linux/ecosystem/testrail/5.5.0.3735/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.0.3735/main/Makefile +++ b/linux/ecosystem/testrail/5.5.0.3735/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.0.3735/main/kaniko-build.py b/linux/ecosystem/testrail/5.5.0.3735/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.0.3735/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.0.3735/main/requirements.txt b/linux/ecosystem/testrail/5.5.0.3735/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.0.3735/main/requirements.txt +++ b/linux/ecosystem/testrail/5.5.0.3735/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.1.3746/ad/Makefile b/linux/ecosystem/testrail/5.5.1.3746/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.1.3746/ad/Makefile +++ b/linux/ecosystem/testrail/5.5.1.3746/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.1.3746/ad/kaniko-build.py b/linux/ecosystem/testrail/5.5.1.3746/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.1.3746/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.1.3746/ad/requirements.txt b/linux/ecosystem/testrail/5.5.1.3746/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.1.3746/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.5.1.3746/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.1.3746/ldap/Makefile b/linux/ecosystem/testrail/5.5.1.3746/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.1.3746/ldap/Makefile +++ b/linux/ecosystem/testrail/5.5.1.3746/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.1.3746/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.5.1.3746/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.1.3746/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.1.3746/ldap/requirements.txt b/linux/ecosystem/testrail/5.5.1.3746/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.1.3746/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.5.1.3746/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.5.1.3746/main/Makefile b/linux/ecosystem/testrail/5.5.1.3746/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.5.1.3746/main/Makefile +++ b/linux/ecosystem/testrail/5.5.1.3746/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.5.1.3746/main/kaniko-build.py b/linux/ecosystem/testrail/5.5.1.3746/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.5.1.3746/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.5.1.3746/main/requirements.txt b/linux/ecosystem/testrail/5.5.1.3746/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.5.1.3746/main/requirements.txt +++ b/linux/ecosystem/testrail/5.5.1.3746/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3853/ad/Makefile b/linux/ecosystem/testrail/5.6.0.3853/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3853/ad/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3853/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3853/ad/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3853/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3853/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3853/ad/requirements.txt b/linux/ecosystem/testrail/5.6.0.3853/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3853/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3853/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3853/ldap/Makefile b/linux/ecosystem/testrail/5.6.0.3853/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3853/ldap/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3853/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3853/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3853/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3853/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3853/ldap/requirements.txt b/linux/ecosystem/testrail/5.6.0.3853/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3853/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3853/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3853/main/Makefile b/linux/ecosystem/testrail/5.6.0.3853/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3853/main/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3853/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3853/main/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3853/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3853/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3853/main/requirements.txt b/linux/ecosystem/testrail/5.6.0.3853/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3853/main/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3853/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3856/ad/Makefile b/linux/ecosystem/testrail/5.6.0.3856/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3856/ad/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3856/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3856/ad/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3856/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3856/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3856/ad/requirements.txt b/linux/ecosystem/testrail/5.6.0.3856/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3856/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3856/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3856/ldap/Makefile b/linux/ecosystem/testrail/5.6.0.3856/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3856/ldap/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3856/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3856/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3856/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3856/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3856/ldap/requirements.txt b/linux/ecosystem/testrail/5.6.0.3856/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3856/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3856/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3856/main/Makefile b/linux/ecosystem/testrail/5.6.0.3856/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3856/main/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3856/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3856/main/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3856/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3856/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3856/main/requirements.txt b/linux/ecosystem/testrail/5.6.0.3856/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3856/main/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3856/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3861/ad/Makefile b/linux/ecosystem/testrail/5.6.0.3861/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3861/ad/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3861/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3861/ad/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3861/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3861/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3861/ad/requirements.txt b/linux/ecosystem/testrail/5.6.0.3861/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3861/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3861/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3861/ldap/Makefile b/linux/ecosystem/testrail/5.6.0.3861/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3861/ldap/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3861/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3861/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3861/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3861/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3861/ldap/requirements.txt b/linux/ecosystem/testrail/5.6.0.3861/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3861/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3861/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3861/main/Makefile b/linux/ecosystem/testrail/5.6.0.3861/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3861/main/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3861/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3861/main/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3861/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3861/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3861/main/requirements.txt b/linux/ecosystem/testrail/5.6.0.3861/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3861/main/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3861/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3862/ad/Makefile b/linux/ecosystem/testrail/5.6.0.3862/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3862/ad/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3862/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3862/ad/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3862/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3862/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3862/ad/requirements.txt b/linux/ecosystem/testrail/5.6.0.3862/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3862/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3862/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3862/ldap/Makefile b/linux/ecosystem/testrail/5.6.0.3862/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3862/ldap/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3862/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3862/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3862/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3862/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3862/ldap/requirements.txt b/linux/ecosystem/testrail/5.6.0.3862/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3862/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3862/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3862/main/Makefile b/linux/ecosystem/testrail/5.6.0.3862/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3862/main/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3862/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3862/main/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3862/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3862/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3862/main/requirements.txt b/linux/ecosystem/testrail/5.6.0.3862/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3862/main/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3862/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3865/ad/Makefile b/linux/ecosystem/testrail/5.6.0.3865/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3865/ad/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3865/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3865/ad/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3865/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3865/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3865/ad/requirements.txt b/linux/ecosystem/testrail/5.6.0.3865/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3865/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3865/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3865/ldap/Makefile b/linux/ecosystem/testrail/5.6.0.3865/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3865/ldap/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3865/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3865/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3865/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3865/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3865/ldap/requirements.txt b/linux/ecosystem/testrail/5.6.0.3865/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3865/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3865/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.6.0.3865/main/Makefile b/linux/ecosystem/testrail/5.6.0.3865/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.6.0.3865/main/Makefile +++ b/linux/ecosystem/testrail/5.6.0.3865/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.6.0.3865/main/kaniko-build.py b/linux/ecosystem/testrail/5.6.0.3865/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.6.0.3865/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.6.0.3865/main/requirements.txt b/linux/ecosystem/testrail/5.6.0.3865/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.6.0.3865/main/requirements.txt +++ b/linux/ecosystem/testrail/5.6.0.3865/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3938/ad/Makefile b/linux/ecosystem/testrail/5.7.0.3938/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3938/ad/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3938/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3938/ad/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3938/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3938/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3938/ad/requirements.txt b/linux/ecosystem/testrail/5.7.0.3938/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3938/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3938/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3938/ldap/Makefile b/linux/ecosystem/testrail/5.7.0.3938/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3938/ldap/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3938/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3938/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3938/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3938/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3938/ldap/requirements.txt b/linux/ecosystem/testrail/5.7.0.3938/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3938/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3938/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3938/main/Makefile b/linux/ecosystem/testrail/5.7.0.3938/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3938/main/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3938/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3938/main/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3938/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3938/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3938/main/requirements.txt b/linux/ecosystem/testrail/5.7.0.3938/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3938/main/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3938/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3942/ad/Makefile b/linux/ecosystem/testrail/5.7.0.3942/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3942/ad/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3942/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3942/ad/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3942/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3942/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3942/ad/requirements.txt b/linux/ecosystem/testrail/5.7.0.3942/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3942/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3942/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3942/ldap/Makefile b/linux/ecosystem/testrail/5.7.0.3942/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3942/ldap/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3942/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3942/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3942/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3942/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3942/ldap/requirements.txt b/linux/ecosystem/testrail/5.7.0.3942/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3942/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3942/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3942/main/Makefile b/linux/ecosystem/testrail/5.7.0.3942/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3942/main/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3942/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3942/main/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3942/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3942/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3942/main/requirements.txt b/linux/ecosystem/testrail/5.7.0.3942/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3942/main/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3942/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3951/ad/Makefile b/linux/ecosystem/testrail/5.7.0.3951/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3951/ad/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3951/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3951/ad/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3951/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3951/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3951/ad/requirements.txt b/linux/ecosystem/testrail/5.7.0.3951/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3951/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3951/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3951/ldap/Makefile b/linux/ecosystem/testrail/5.7.0.3951/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3951/ldap/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3951/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3951/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3951/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3951/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3951/ldap/requirements.txt b/linux/ecosystem/testrail/5.7.0.3951/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3951/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3951/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.0.3951/main/Makefile b/linux/ecosystem/testrail/5.7.0.3951/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.0.3951/main/Makefile +++ b/linux/ecosystem/testrail/5.7.0.3951/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.0.3951/main/kaniko-build.py b/linux/ecosystem/testrail/5.7.0.3951/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.0.3951/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.0.3951/main/requirements.txt b/linux/ecosystem/testrail/5.7.0.3951/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.0.3951/main/requirements.txt +++ b/linux/ecosystem/testrail/5.7.0.3951/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.1.4026/ad/Makefile b/linux/ecosystem/testrail/5.7.1.4026/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.1.4026/ad/Makefile +++ b/linux/ecosystem/testrail/5.7.1.4026/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.1.4026/ad/kaniko-build.py b/linux/ecosystem/testrail/5.7.1.4026/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.1.4026/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.1.4026/ad/requirements.txt b/linux/ecosystem/testrail/5.7.1.4026/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.1.4026/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.7.1.4026/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.1.4026/ldap/Makefile b/linux/ecosystem/testrail/5.7.1.4026/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.1.4026/ldap/Makefile +++ b/linux/ecosystem/testrail/5.7.1.4026/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.1.4026/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.7.1.4026/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.1.4026/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.1.4026/ldap/requirements.txt b/linux/ecosystem/testrail/5.7.1.4026/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.1.4026/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.7.1.4026/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.1.4026/main/Makefile b/linux/ecosystem/testrail/5.7.1.4026/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.1.4026/main/Makefile +++ b/linux/ecosystem/testrail/5.7.1.4026/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.1.4026/main/kaniko-build.py b/linux/ecosystem/testrail/5.7.1.4026/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.1.4026/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.1.4026/main/requirements.txt b/linux/ecosystem/testrail/5.7.1.4026/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.1.4026/main/requirements.txt +++ b/linux/ecosystem/testrail/5.7.1.4026/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.1.4028/ad/Makefile b/linux/ecosystem/testrail/5.7.1.4028/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.1.4028/ad/Makefile +++ b/linux/ecosystem/testrail/5.7.1.4028/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.1.4028/ad/kaniko-build.py b/linux/ecosystem/testrail/5.7.1.4028/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.1.4028/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.1.4028/ad/requirements.txt b/linux/ecosystem/testrail/5.7.1.4028/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.1.4028/ad/requirements.txt +++ b/linux/ecosystem/testrail/5.7.1.4028/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.1.4028/ldap/Makefile b/linux/ecosystem/testrail/5.7.1.4028/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.1.4028/ldap/Makefile +++ b/linux/ecosystem/testrail/5.7.1.4028/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.1.4028/ldap/kaniko-build.py b/linux/ecosystem/testrail/5.7.1.4028/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.1.4028/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.1.4028/ldap/requirements.txt b/linux/ecosystem/testrail/5.7.1.4028/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.1.4028/ldap/requirements.txt +++ b/linux/ecosystem/testrail/5.7.1.4028/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/5.7.1.4028/main/Makefile b/linux/ecosystem/testrail/5.7.1.4028/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/5.7.1.4028/main/Makefile +++ b/linux/ecosystem/testrail/5.7.1.4028/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/5.7.1.4028/main/kaniko-build.py b/linux/ecosystem/testrail/5.7.1.4028/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/5.7.1.4028/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/5.7.1.4028/main/requirements.txt b/linux/ecosystem/testrail/5.7.1.4028/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/5.7.1.4028/main/requirements.txt +++ b/linux/ecosystem/testrail/5.7.1.4028/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.0.0.4140/ad/Makefile b/linux/ecosystem/testrail/6.0.0.4140/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.0.0.4140/ad/Makefile +++ b/linux/ecosystem/testrail/6.0.0.4140/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.0.0.4140/ad/kaniko-build.py b/linux/ecosystem/testrail/6.0.0.4140/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.0.0.4140/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.0.0.4140/ad/requirements.txt b/linux/ecosystem/testrail/6.0.0.4140/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.0.0.4140/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.0.0.4140/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.0.0.4140/ldap/Makefile b/linux/ecosystem/testrail/6.0.0.4140/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.0.0.4140/ldap/Makefile +++ b/linux/ecosystem/testrail/6.0.0.4140/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.0.0.4140/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.0.0.4140/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.0.0.4140/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.0.0.4140/ldap/requirements.txt b/linux/ecosystem/testrail/6.0.0.4140/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.0.0.4140/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.0.0.4140/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.0.0.4140/main/Makefile b/linux/ecosystem/testrail/6.0.0.4140/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.0.0.4140/main/Makefile +++ b/linux/ecosystem/testrail/6.0.0.4140/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.0.0.4140/main/kaniko-build.py b/linux/ecosystem/testrail/6.0.0.4140/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.0.0.4140/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.0.0.4140/main/requirements.txt b/linux/ecosystem/testrail/6.0.0.4140/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.0.0.4140/main/requirements.txt +++ b/linux/ecosystem/testrail/6.0.0.4140/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.0.1.4163/ad/Makefile b/linux/ecosystem/testrail/6.0.1.4163/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.0.1.4163/ad/Makefile +++ b/linux/ecosystem/testrail/6.0.1.4163/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.0.1.4163/ad/kaniko-build.py b/linux/ecosystem/testrail/6.0.1.4163/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.0.1.4163/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.0.1.4163/ad/requirements.txt b/linux/ecosystem/testrail/6.0.1.4163/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.0.1.4163/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.0.1.4163/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.0.1.4163/ldap/Makefile b/linux/ecosystem/testrail/6.0.1.4163/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.0.1.4163/ldap/Makefile +++ b/linux/ecosystem/testrail/6.0.1.4163/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.0.1.4163/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.0.1.4163/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.0.1.4163/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.0.1.4163/ldap/requirements.txt b/linux/ecosystem/testrail/6.0.1.4163/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.0.1.4163/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.0.1.4163/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.0.1.4163/main/Makefile b/linux/ecosystem/testrail/6.0.1.4163/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.0.1.4163/main/Makefile +++ b/linux/ecosystem/testrail/6.0.1.4163/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.0.1.4163/main/kaniko-build.py b/linux/ecosystem/testrail/6.0.1.4163/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.0.1.4163/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.0.1.4163/main/requirements.txt b/linux/ecosystem/testrail/6.0.1.4163/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.0.1.4163/main/requirements.txt +++ b/linux/ecosystem/testrail/6.0.1.4163/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.0.4367/ad/Makefile b/linux/ecosystem/testrail/6.1.0.4367/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.0.4367/ad/Makefile +++ b/linux/ecosystem/testrail/6.1.0.4367/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.0.4367/ad/kaniko-build.py b/linux/ecosystem/testrail/6.1.0.4367/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.0.4367/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.0.4367/ad/requirements.txt b/linux/ecosystem/testrail/6.1.0.4367/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.0.4367/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.1.0.4367/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.0.4367/ldap/Makefile b/linux/ecosystem/testrail/6.1.0.4367/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.0.4367/ldap/Makefile +++ b/linux/ecosystem/testrail/6.1.0.4367/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.0.4367/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.1.0.4367/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.0.4367/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.0.4367/ldap/requirements.txt b/linux/ecosystem/testrail/6.1.0.4367/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.0.4367/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.1.0.4367/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.0.4367/main/Makefile b/linux/ecosystem/testrail/6.1.0.4367/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.0.4367/main/Makefile +++ b/linux/ecosystem/testrail/6.1.0.4367/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.0.4367/main/kaniko-build.py b/linux/ecosystem/testrail/6.1.0.4367/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.0.4367/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.0.4367/main/requirements.txt b/linux/ecosystem/testrail/6.1.0.4367/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.0.4367/main/requirements.txt +++ b/linux/ecosystem/testrail/6.1.0.4367/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.0.4369/ad/Makefile b/linux/ecosystem/testrail/6.1.0.4369/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.0.4369/ad/Makefile +++ b/linux/ecosystem/testrail/6.1.0.4369/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.0.4369/ad/kaniko-build.py b/linux/ecosystem/testrail/6.1.0.4369/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.0.4369/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.0.4369/ad/requirements.txt b/linux/ecosystem/testrail/6.1.0.4369/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.0.4369/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.1.0.4369/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.0.4369/ldap/Makefile b/linux/ecosystem/testrail/6.1.0.4369/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.0.4369/ldap/Makefile +++ b/linux/ecosystem/testrail/6.1.0.4369/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.0.4369/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.1.0.4369/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.0.4369/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.0.4369/ldap/requirements.txt b/linux/ecosystem/testrail/6.1.0.4369/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.0.4369/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.1.0.4369/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.0.4369/main/Makefile b/linux/ecosystem/testrail/6.1.0.4369/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.0.4369/main/Makefile +++ b/linux/ecosystem/testrail/6.1.0.4369/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.0.4369/main/kaniko-build.py b/linux/ecosystem/testrail/6.1.0.4369/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.0.4369/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.0.4369/main/requirements.txt b/linux/ecosystem/testrail/6.1.0.4369/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.0.4369/main/requirements.txt +++ b/linux/ecosystem/testrail/6.1.0.4369/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.1.1020/ad/Makefile b/linux/ecosystem/testrail/6.1.1.1020/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.1.1020/ad/Makefile +++ b/linux/ecosystem/testrail/6.1.1.1020/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.1.1020/ad/kaniko-build.py b/linux/ecosystem/testrail/6.1.1.1020/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.1.1020/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.1.1020/ad/requirements.txt b/linux/ecosystem/testrail/6.1.1.1020/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.1.1020/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.1.1.1020/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.1.1020/ldap/Makefile b/linux/ecosystem/testrail/6.1.1.1020/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.1.1020/ldap/Makefile +++ b/linux/ecosystem/testrail/6.1.1.1020/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.1.1020/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.1.1.1020/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.1.1020/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.1.1020/ldap/requirements.txt b/linux/ecosystem/testrail/6.1.1.1020/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.1.1020/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.1.1.1020/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.1.1020/main/Makefile b/linux/ecosystem/testrail/6.1.1.1020/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.1.1020/main/Makefile +++ b/linux/ecosystem/testrail/6.1.1.1020/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.1.1020/main/kaniko-build.py b/linux/ecosystem/testrail/6.1.1.1020/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.1.1020/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.1.1020/main/requirements.txt b/linux/ecosystem/testrail/6.1.1.1020/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.1.1020/main/requirements.txt +++ b/linux/ecosystem/testrail/6.1.1.1020/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.1.1021/ad/Makefile b/linux/ecosystem/testrail/6.1.1.1021/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.1.1021/ad/Makefile +++ b/linux/ecosystem/testrail/6.1.1.1021/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.1.1021/ad/kaniko-build.py b/linux/ecosystem/testrail/6.1.1.1021/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.1.1021/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.1.1021/ad/requirements.txt b/linux/ecosystem/testrail/6.1.1.1021/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.1.1021/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.1.1.1021/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.1.1021/ldap/Makefile b/linux/ecosystem/testrail/6.1.1.1021/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.1.1021/ldap/Makefile +++ b/linux/ecosystem/testrail/6.1.1.1021/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.1.1021/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.1.1.1021/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.1.1021/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.1.1021/ldap/requirements.txt b/linux/ecosystem/testrail/6.1.1.1021/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.1.1021/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.1.1.1021/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.1.1.1021/main/Makefile b/linux/ecosystem/testrail/6.1.1.1021/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.1.1.1021/main/Makefile +++ b/linux/ecosystem/testrail/6.1.1.1021/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.1.1.1021/main/kaniko-build.py b/linux/ecosystem/testrail/6.1.1.1021/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.1.1.1021/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.1.1.1021/main/requirements.txt b/linux/ecosystem/testrail/6.1.1.1021/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.1.1.1021/main/requirements.txt +++ b/linux/ecosystem/testrail/6.1.1.1021/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.0.1085/ad/Makefile b/linux/ecosystem/testrail/6.2.0.1085/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.0.1085/ad/Makefile +++ b/linux/ecosystem/testrail/6.2.0.1085/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.0.1085/ad/kaniko-build.py b/linux/ecosystem/testrail/6.2.0.1085/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.0.1085/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.0.1085/ad/requirements.txt b/linux/ecosystem/testrail/6.2.0.1085/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.0.1085/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.2.0.1085/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.0.1085/ldap/Makefile b/linux/ecosystem/testrail/6.2.0.1085/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.0.1085/ldap/Makefile +++ b/linux/ecosystem/testrail/6.2.0.1085/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.0.1085/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.2.0.1085/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.0.1085/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.0.1085/ldap/requirements.txt b/linux/ecosystem/testrail/6.2.0.1085/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.0.1085/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.2.0.1085/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.0.1085/main/Makefile b/linux/ecosystem/testrail/6.2.0.1085/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.0.1085/main/Makefile +++ b/linux/ecosystem/testrail/6.2.0.1085/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.0.1085/main/kaniko-build.py b/linux/ecosystem/testrail/6.2.0.1085/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.0.1085/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.0.1085/main/requirements.txt b/linux/ecosystem/testrail/6.2.0.1085/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.0.1085/main/requirements.txt +++ b/linux/ecosystem/testrail/6.2.0.1085/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.1.1003/ad/Makefile b/linux/ecosystem/testrail/6.2.1.1003/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.1.1003/ad/Makefile +++ b/linux/ecosystem/testrail/6.2.1.1003/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.1.1003/ad/kaniko-build.py b/linux/ecosystem/testrail/6.2.1.1003/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.1.1003/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.1.1003/ad/requirements.txt b/linux/ecosystem/testrail/6.2.1.1003/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.1.1003/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.2.1.1003/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.1.1003/ldap/Makefile b/linux/ecosystem/testrail/6.2.1.1003/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.1.1003/ldap/Makefile +++ b/linux/ecosystem/testrail/6.2.1.1003/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.1.1003/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.2.1.1003/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.1.1003/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.1.1003/ldap/requirements.txt b/linux/ecosystem/testrail/6.2.1.1003/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.1.1003/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.2.1.1003/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.1.1003/main/Makefile b/linux/ecosystem/testrail/6.2.1.1003/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.1.1003/main/Makefile +++ b/linux/ecosystem/testrail/6.2.1.1003/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.1.1003/main/kaniko-build.py b/linux/ecosystem/testrail/6.2.1.1003/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.1.1003/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.1.1003/main/requirements.txt b/linux/ecosystem/testrail/6.2.1.1003/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.1.1003/main/requirements.txt +++ b/linux/ecosystem/testrail/6.2.1.1003/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.1.1005/ad/Makefile b/linux/ecosystem/testrail/6.2.1.1005/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.1.1005/ad/Makefile +++ b/linux/ecosystem/testrail/6.2.1.1005/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.1.1005/ad/kaniko-build.py b/linux/ecosystem/testrail/6.2.1.1005/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.1.1005/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.1.1005/ad/requirements.txt b/linux/ecosystem/testrail/6.2.1.1005/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.1.1005/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.2.1.1005/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.1.1005/ldap/Makefile b/linux/ecosystem/testrail/6.2.1.1005/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.1.1005/ldap/Makefile +++ b/linux/ecosystem/testrail/6.2.1.1005/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.1.1005/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.2.1.1005/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.1.1005/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.1.1005/ldap/requirements.txt b/linux/ecosystem/testrail/6.2.1.1005/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.1.1005/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.2.1.1005/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.1.1005/main/Makefile b/linux/ecosystem/testrail/6.2.1.1005/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.1.1005/main/Makefile +++ b/linux/ecosystem/testrail/6.2.1.1005/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.1.1005/main/kaniko-build.py b/linux/ecosystem/testrail/6.2.1.1005/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.1.1005/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.1.1005/main/requirements.txt b/linux/ecosystem/testrail/6.2.1.1005/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.1.1005/main/requirements.txt +++ b/linux/ecosystem/testrail/6.2.1.1005/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.2.1107/ad/Makefile b/linux/ecosystem/testrail/6.2.2.1107/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.2.1107/ad/Makefile +++ b/linux/ecosystem/testrail/6.2.2.1107/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.2.1107/ad/kaniko-build.py b/linux/ecosystem/testrail/6.2.2.1107/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.2.1107/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.2.1107/ad/requirements.txt b/linux/ecosystem/testrail/6.2.2.1107/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.2.1107/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.2.2.1107/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.2.1107/ldap/Makefile b/linux/ecosystem/testrail/6.2.2.1107/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.2.1107/ldap/Makefile +++ b/linux/ecosystem/testrail/6.2.2.1107/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.2.1107/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.2.2.1107/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.2.1107/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.2.1107/ldap/requirements.txt b/linux/ecosystem/testrail/6.2.2.1107/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.2.1107/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.2.2.1107/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.2.1107/main/Makefile b/linux/ecosystem/testrail/6.2.2.1107/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.2.1107/main/Makefile +++ b/linux/ecosystem/testrail/6.2.2.1107/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.2.1107/main/kaniko-build.py b/linux/ecosystem/testrail/6.2.2.1107/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.2.1107/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.2.1107/main/requirements.txt b/linux/ecosystem/testrail/6.2.2.1107/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.2.1107/main/requirements.txt +++ b/linux/ecosystem/testrail/6.2.2.1107/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.3.1114/ad/Makefile b/linux/ecosystem/testrail/6.2.3.1114/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.3.1114/ad/Makefile +++ b/linux/ecosystem/testrail/6.2.3.1114/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.3.1114/ad/kaniko-build.py b/linux/ecosystem/testrail/6.2.3.1114/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.3.1114/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.3.1114/ad/requirements.txt b/linux/ecosystem/testrail/6.2.3.1114/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.3.1114/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.2.3.1114/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.3.1114/ldap/Makefile b/linux/ecosystem/testrail/6.2.3.1114/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.3.1114/ldap/Makefile +++ b/linux/ecosystem/testrail/6.2.3.1114/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.3.1114/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.2.3.1114/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.3.1114/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.3.1114/ldap/requirements.txt b/linux/ecosystem/testrail/6.2.3.1114/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.3.1114/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.2.3.1114/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.2.3.1114/main/Makefile b/linux/ecosystem/testrail/6.2.3.1114/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.2.3.1114/main/Makefile +++ b/linux/ecosystem/testrail/6.2.3.1114/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.2.3.1114/main/kaniko-build.py b/linux/ecosystem/testrail/6.2.3.1114/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.2.3.1114/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.2.3.1114/main/requirements.txt b/linux/ecosystem/testrail/6.2.3.1114/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.2.3.1114/main/requirements.txt +++ b/linux/ecosystem/testrail/6.2.3.1114/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.0.1120/ad/Makefile b/linux/ecosystem/testrail/6.3.0.1120/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.0.1120/ad/Makefile +++ b/linux/ecosystem/testrail/6.3.0.1120/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.0.1120/ad/kaniko-build.py b/linux/ecosystem/testrail/6.3.0.1120/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.0.1120/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.0.1120/ad/requirements.txt b/linux/ecosystem/testrail/6.3.0.1120/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.0.1120/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.3.0.1120/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.0.1120/ldap/Makefile b/linux/ecosystem/testrail/6.3.0.1120/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.0.1120/ldap/Makefile +++ b/linux/ecosystem/testrail/6.3.0.1120/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.0.1120/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.3.0.1120/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.0.1120/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.0.1120/ldap/requirements.txt b/linux/ecosystem/testrail/6.3.0.1120/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.0.1120/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.3.0.1120/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.0.1120/main/Makefile b/linux/ecosystem/testrail/6.3.0.1120/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.0.1120/main/Makefile +++ b/linux/ecosystem/testrail/6.3.0.1120/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.0.1120/main/kaniko-build.py b/linux/ecosystem/testrail/6.3.0.1120/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.0.1120/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.0.1120/main/requirements.txt b/linux/ecosystem/testrail/6.3.0.1120/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.0.1120/main/requirements.txt +++ b/linux/ecosystem/testrail/6.3.0.1120/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.1.1004/ad/Makefile b/linux/ecosystem/testrail/6.3.1.1004/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.1.1004/ad/Makefile +++ b/linux/ecosystem/testrail/6.3.1.1004/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.1.1004/ad/kaniko-build.py b/linux/ecosystem/testrail/6.3.1.1004/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.1.1004/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.1.1004/ad/requirements.txt b/linux/ecosystem/testrail/6.3.1.1004/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.1.1004/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.3.1.1004/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.1.1004/ldap/Makefile b/linux/ecosystem/testrail/6.3.1.1004/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.1.1004/ldap/Makefile +++ b/linux/ecosystem/testrail/6.3.1.1004/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.1.1004/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.3.1.1004/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.1.1004/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.1.1004/ldap/requirements.txt b/linux/ecosystem/testrail/6.3.1.1004/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.1.1004/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.3.1.1004/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.1.1004/main/Makefile b/linux/ecosystem/testrail/6.3.1.1004/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.1.1004/main/Makefile +++ b/linux/ecosystem/testrail/6.3.1.1004/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.1.1004/main/kaniko-build.py b/linux/ecosystem/testrail/6.3.1.1004/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.1.1004/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.1.1004/main/requirements.txt b/linux/ecosystem/testrail/6.3.1.1004/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.1.1004/main/requirements.txt +++ b/linux/ecosystem/testrail/6.3.1.1004/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.1.1006/ad/Makefile b/linux/ecosystem/testrail/6.3.1.1006/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.1.1006/ad/Makefile +++ b/linux/ecosystem/testrail/6.3.1.1006/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.1.1006/ad/kaniko-build.py b/linux/ecosystem/testrail/6.3.1.1006/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.1.1006/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.1.1006/ad/requirements.txt b/linux/ecosystem/testrail/6.3.1.1006/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.1.1006/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.3.1.1006/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.1.1006/ldap/Makefile b/linux/ecosystem/testrail/6.3.1.1006/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.1.1006/ldap/Makefile +++ b/linux/ecosystem/testrail/6.3.1.1006/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.1.1006/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.3.1.1006/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.1.1006/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.1.1006/ldap/requirements.txt b/linux/ecosystem/testrail/6.3.1.1006/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.1.1006/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.3.1.1006/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.3.1.1006/main/Makefile b/linux/ecosystem/testrail/6.3.1.1006/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.3.1.1006/main/Makefile +++ b/linux/ecosystem/testrail/6.3.1.1006/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.3.1.1006/main/kaniko-build.py b/linux/ecosystem/testrail/6.3.1.1006/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.3.1.1006/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.3.1.1006/main/requirements.txt b/linux/ecosystem/testrail/6.3.1.1006/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.3.1.1006/main/requirements.txt +++ b/linux/ecosystem/testrail/6.3.1.1006/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.4.0.1284/ad/Makefile b/linux/ecosystem/testrail/6.4.0.1284/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.4.0.1284/ad/Makefile +++ b/linux/ecosystem/testrail/6.4.0.1284/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.4.0.1284/ad/kaniko-build.py b/linux/ecosystem/testrail/6.4.0.1284/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.4.0.1284/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.4.0.1284/ad/requirements.txt b/linux/ecosystem/testrail/6.4.0.1284/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.4.0.1284/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.4.0.1284/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.4.0.1284/ldap/Makefile b/linux/ecosystem/testrail/6.4.0.1284/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.4.0.1284/ldap/Makefile +++ b/linux/ecosystem/testrail/6.4.0.1284/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.4.0.1284/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.4.0.1284/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.4.0.1284/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.4.0.1284/ldap/requirements.txt b/linux/ecosystem/testrail/6.4.0.1284/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.4.0.1284/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.4.0.1284/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.4.0.1284/main/Makefile b/linux/ecosystem/testrail/6.4.0.1284/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.4.0.1284/main/Makefile +++ b/linux/ecosystem/testrail/6.4.0.1284/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.4.0.1284/main/kaniko-build.py b/linux/ecosystem/testrail/6.4.0.1284/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.4.0.1284/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.4.0.1284/main/requirements.txt b/linux/ecosystem/testrail/6.4.0.1284/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.4.0.1284/main/requirements.txt +++ b/linux/ecosystem/testrail/6.4.0.1284/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.4.0.1293/ad/Makefile b/linux/ecosystem/testrail/6.4.0.1293/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.4.0.1293/ad/Makefile +++ b/linux/ecosystem/testrail/6.4.0.1293/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.4.0.1293/ad/kaniko-build.py b/linux/ecosystem/testrail/6.4.0.1293/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.4.0.1293/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.4.0.1293/ad/requirements.txt b/linux/ecosystem/testrail/6.4.0.1293/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.4.0.1293/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.4.0.1293/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.4.0.1293/ldap/Makefile b/linux/ecosystem/testrail/6.4.0.1293/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.4.0.1293/ldap/Makefile +++ b/linux/ecosystem/testrail/6.4.0.1293/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.4.0.1293/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.4.0.1293/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.4.0.1293/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.4.0.1293/ldap/requirements.txt b/linux/ecosystem/testrail/6.4.0.1293/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.4.0.1293/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.4.0.1293/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.4.0.1293/main/Makefile b/linux/ecosystem/testrail/6.4.0.1293/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.4.0.1293/main/Makefile +++ b/linux/ecosystem/testrail/6.4.0.1293/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.4.0.1293/main/kaniko-build.py b/linux/ecosystem/testrail/6.4.0.1293/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.4.0.1293/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.4.0.1293/main/requirements.txt b/linux/ecosystem/testrail/6.4.0.1293/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.4.0.1293/main/requirements.txt +++ b/linux/ecosystem/testrail/6.4.0.1293/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.0.1298/ad/Makefile b/linux/ecosystem/testrail/6.5.0.1298/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.0.1298/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.0.1298/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.0.1298/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.0.1298/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.0.1298/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.0.1298/ad/requirements.txt b/linux/ecosystem/testrail/6.5.0.1298/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.0.1298/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.0.1298/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.0.1298/ldap/Makefile b/linux/ecosystem/testrail/6.5.0.1298/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.0.1298/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.0.1298/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.0.1298/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.0.1298/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.0.1298/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.0.1298/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.0.1298/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.0.1298/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.0.1298/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.0.1298/main/Makefile b/linux/ecosystem/testrail/6.5.0.1298/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.0.1298/main/Makefile +++ b/linux/ecosystem/testrail/6.5.0.1298/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.0.1298/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.0.1298/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.0.1298/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.0.1298/main/requirements.txt b/linux/ecosystem/testrail/6.5.0.1298/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.0.1298/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.0.1298/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.1.1002/ad/Makefile b/linux/ecosystem/testrail/6.5.1.1002/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.1.1002/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.1.1002/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.1.1002/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.1.1002/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.1.1002/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.1.1002/ad/requirements.txt b/linux/ecosystem/testrail/6.5.1.1002/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.1.1002/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.1.1002/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.1.1002/ldap/Makefile b/linux/ecosystem/testrail/6.5.1.1002/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.1.1002/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.1.1002/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.1.1002/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.1.1002/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.1.1002/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.1.1002/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.1.1002/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.1.1002/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.1.1002/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.1.1002/main/Makefile b/linux/ecosystem/testrail/6.5.1.1002/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.1.1002/main/Makefile +++ b/linux/ecosystem/testrail/6.5.1.1002/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.1.1002/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.1.1002/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.1.1002/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.1.1002/main/requirements.txt b/linux/ecosystem/testrail/6.5.1.1002/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.1.1002/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.1.1002/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.3.1001/ad/Makefile b/linux/ecosystem/testrail/6.5.3.1001/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.3.1001/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.3.1001/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.3.1001/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.3.1001/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.3.1001/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.3.1001/ad/requirements.txt b/linux/ecosystem/testrail/6.5.3.1001/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.3.1001/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.3.1001/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.3.1001/ldap/Makefile b/linux/ecosystem/testrail/6.5.3.1001/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.3.1001/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.3.1001/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.3.1001/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.3.1001/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.3.1001/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.3.1001/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.3.1001/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.3.1001/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.3.1001/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.3.1001/main/Makefile b/linux/ecosystem/testrail/6.5.3.1001/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.3.1001/main/Makefile +++ b/linux/ecosystem/testrail/6.5.3.1001/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.3.1001/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.3.1001/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.3.1001/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.3.1001/main/requirements.txt b/linux/ecosystem/testrail/6.5.3.1001/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.3.1001/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.3.1001/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.4.1002/ad/Makefile b/linux/ecosystem/testrail/6.5.4.1002/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.4.1002/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.4.1002/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.4.1002/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.4.1002/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.4.1002/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.4.1002/ad/requirements.txt b/linux/ecosystem/testrail/6.5.4.1002/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.4.1002/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.4.1002/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.4.1002/ldap/Makefile b/linux/ecosystem/testrail/6.5.4.1002/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.4.1002/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.4.1002/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.4.1002/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.4.1002/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.4.1002/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.4.1002/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.4.1002/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.4.1002/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.4.1002/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.4.1002/main/Makefile b/linux/ecosystem/testrail/6.5.4.1002/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.4.1002/main/Makefile +++ b/linux/ecosystem/testrail/6.5.4.1002/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.4.1002/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.4.1002/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.4.1002/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.4.1002/main/requirements.txt b/linux/ecosystem/testrail/6.5.4.1002/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.4.1002/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.4.1002/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.4.1007/ad/Makefile b/linux/ecosystem/testrail/6.5.4.1007/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.4.1007/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.4.1007/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.4.1007/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.4.1007/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.4.1007/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.4.1007/ad/requirements.txt b/linux/ecosystem/testrail/6.5.4.1007/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.4.1007/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.4.1007/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.4.1007/ldap/Makefile b/linux/ecosystem/testrail/6.5.4.1007/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.4.1007/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.4.1007/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.4.1007/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.4.1007/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.4.1007/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.4.1007/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.4.1007/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.4.1007/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.4.1007/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.4.1007/main/Makefile b/linux/ecosystem/testrail/6.5.4.1007/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.4.1007/main/Makefile +++ b/linux/ecosystem/testrail/6.5.4.1007/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.4.1007/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.4.1007/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.4.1007/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.4.1007/main/requirements.txt b/linux/ecosystem/testrail/6.5.4.1007/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.4.1007/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.4.1007/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.5.1009/ad/Makefile b/linux/ecosystem/testrail/6.5.5.1009/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.5.1009/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.5.1009/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.5.1009/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.5.1009/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.5.1009/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.5.1009/ad/requirements.txt b/linux/ecosystem/testrail/6.5.5.1009/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.5.1009/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.5.1009/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.5.1009/ldap/Makefile b/linux/ecosystem/testrail/6.5.5.1009/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.5.1009/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.5.1009/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.5.1009/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.5.1009/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.5.1009/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.5.1009/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.5.1009/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.5.1009/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.5.1009/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.5.1009/main/Makefile b/linux/ecosystem/testrail/6.5.5.1009/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.5.1009/main/Makefile +++ b/linux/ecosystem/testrail/6.5.5.1009/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.5.1009/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.5.1009/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.5.1009/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.5.1009/main/requirements.txt b/linux/ecosystem/testrail/6.5.5.1009/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.5.1009/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.5.1009/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.6.1014/ad/Makefile b/linux/ecosystem/testrail/6.5.6.1014/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.6.1014/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.6.1014/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.6.1014/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.6.1014/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.6.1014/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.6.1014/ad/requirements.txt b/linux/ecosystem/testrail/6.5.6.1014/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.6.1014/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.6.1014/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.6.1014/ldap/Makefile b/linux/ecosystem/testrail/6.5.6.1014/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.6.1014/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.6.1014/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.6.1014/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.6.1014/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.6.1014/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.6.1014/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.6.1014/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.6.1014/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.6.1014/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.6.1014/main/Makefile b/linux/ecosystem/testrail/6.5.6.1014/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.6.1014/main/Makefile +++ b/linux/ecosystem/testrail/6.5.6.1014/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.6.1014/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.6.1014/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.6.1014/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.6.1014/main/requirements.txt b/linux/ecosystem/testrail/6.5.6.1014/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.6.1014/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.6.1014/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.7.1000/ad/Makefile b/linux/ecosystem/testrail/6.5.7.1000/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.7.1000/ad/Makefile +++ b/linux/ecosystem/testrail/6.5.7.1000/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.7.1000/ad/kaniko-build.py b/linux/ecosystem/testrail/6.5.7.1000/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.7.1000/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.7.1000/ad/requirements.txt b/linux/ecosystem/testrail/6.5.7.1000/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.7.1000/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.5.7.1000/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.7.1000/ldap/Makefile b/linux/ecosystem/testrail/6.5.7.1000/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.7.1000/ldap/Makefile +++ b/linux/ecosystem/testrail/6.5.7.1000/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.7.1000/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.5.7.1000/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.7.1000/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.7.1000/ldap/requirements.txt b/linux/ecosystem/testrail/6.5.7.1000/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.7.1000/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.5.7.1000/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.5.7.1000/main/Makefile b/linux/ecosystem/testrail/6.5.7.1000/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.5.7.1000/main/Makefile +++ b/linux/ecosystem/testrail/6.5.7.1000/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.5.7.1000/main/kaniko-build.py b/linux/ecosystem/testrail/6.5.7.1000/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.5.7.1000/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.5.7.1000/main/requirements.txt b/linux/ecosystem/testrail/6.5.7.1000/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.5.7.1000/main/requirements.txt +++ b/linux/ecosystem/testrail/6.5.7.1000/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.6.0.1156/ad/Makefile b/linux/ecosystem/testrail/6.6.0.1156/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.6.0.1156/ad/Makefile +++ b/linux/ecosystem/testrail/6.6.0.1156/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.6.0.1156/ad/kaniko-build.py b/linux/ecosystem/testrail/6.6.0.1156/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.6.0.1156/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.6.0.1156/ad/requirements.txt b/linux/ecosystem/testrail/6.6.0.1156/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.6.0.1156/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.6.0.1156/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.6.0.1156/ldap/Makefile b/linux/ecosystem/testrail/6.6.0.1156/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.6.0.1156/ldap/Makefile +++ b/linux/ecosystem/testrail/6.6.0.1156/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.6.0.1156/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.6.0.1156/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.6.0.1156/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.6.0.1156/ldap/requirements.txt b/linux/ecosystem/testrail/6.6.0.1156/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.6.0.1156/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.6.0.1156/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.6.0.1156/main/Makefile b/linux/ecosystem/testrail/6.6.0.1156/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.6.0.1156/main/Makefile +++ b/linux/ecosystem/testrail/6.6.0.1156/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.6.0.1156/main/kaniko-build.py b/linux/ecosystem/testrail/6.6.0.1156/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.6.0.1156/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.6.0.1156/main/requirements.txt b/linux/ecosystem/testrail/6.6.0.1156/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.6.0.1156/main/requirements.txt +++ b/linux/ecosystem/testrail/6.6.0.1156/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.6.1.1166/ad/Makefile b/linux/ecosystem/testrail/6.6.1.1166/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.6.1.1166/ad/Makefile +++ b/linux/ecosystem/testrail/6.6.1.1166/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.6.1.1166/ad/kaniko-build.py b/linux/ecosystem/testrail/6.6.1.1166/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.6.1.1166/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.6.1.1166/ad/requirements.txt b/linux/ecosystem/testrail/6.6.1.1166/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.6.1.1166/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.6.1.1166/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.6.1.1166/ldap/Makefile b/linux/ecosystem/testrail/6.6.1.1166/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.6.1.1166/ldap/Makefile +++ b/linux/ecosystem/testrail/6.6.1.1166/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.6.1.1166/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.6.1.1166/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.6.1.1166/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.6.1.1166/ldap/requirements.txt b/linux/ecosystem/testrail/6.6.1.1166/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.6.1.1166/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.6.1.1166/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.6.1.1166/main/Makefile b/linux/ecosystem/testrail/6.6.1.1166/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.6.1.1166/main/Makefile +++ b/linux/ecosystem/testrail/6.6.1.1166/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.6.1.1166/main/kaniko-build.py b/linux/ecosystem/testrail/6.6.1.1166/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.6.1.1166/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.6.1.1166/main/requirements.txt b/linux/ecosystem/testrail/6.6.1.1166/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.6.1.1166/main/requirements.txt +++ b/linux/ecosystem/testrail/6.6.1.1166/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.1.1020/ad/Makefile b/linux/ecosystem/testrail/6.7.1.1020/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.1.1020/ad/Makefile +++ b/linux/ecosystem/testrail/6.7.1.1020/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.1.1020/ad/kaniko-build.py b/linux/ecosystem/testrail/6.7.1.1020/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.1.1020/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.1.1020/ad/requirements.txt b/linux/ecosystem/testrail/6.7.1.1020/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.1.1020/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.7.1.1020/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.1.1020/ldap/Makefile b/linux/ecosystem/testrail/6.7.1.1020/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.1.1020/ldap/Makefile +++ b/linux/ecosystem/testrail/6.7.1.1020/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.1.1020/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.7.1.1020/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.1.1020/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.1.1020/ldap/requirements.txt b/linux/ecosystem/testrail/6.7.1.1020/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.1.1020/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.7.1.1020/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.1.1020/main/Makefile b/linux/ecosystem/testrail/6.7.1.1020/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.1.1020/main/Makefile +++ b/linux/ecosystem/testrail/6.7.1.1020/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.1.1020/main/kaniko-build.py b/linux/ecosystem/testrail/6.7.1.1020/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.1.1020/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.1.1020/main/requirements.txt b/linux/ecosystem/testrail/6.7.1.1020/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.1.1020/main/requirements.txt +++ b/linux/ecosystem/testrail/6.7.1.1020/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.2.1037/ad/Makefile b/linux/ecosystem/testrail/6.7.2.1037/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.2.1037/ad/Makefile +++ b/linux/ecosystem/testrail/6.7.2.1037/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.2.1037/ad/kaniko-build.py b/linux/ecosystem/testrail/6.7.2.1037/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.2.1037/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.2.1037/ad/requirements.txt b/linux/ecosystem/testrail/6.7.2.1037/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.2.1037/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.7.2.1037/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.2.1037/ldap/Makefile b/linux/ecosystem/testrail/6.7.2.1037/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.2.1037/ldap/Makefile +++ b/linux/ecosystem/testrail/6.7.2.1037/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.2.1037/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.7.2.1037/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.2.1037/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.2.1037/ldap/requirements.txt b/linux/ecosystem/testrail/6.7.2.1037/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.2.1037/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.7.2.1037/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.2.1037/main/Makefile b/linux/ecosystem/testrail/6.7.2.1037/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.2.1037/main/Makefile +++ b/linux/ecosystem/testrail/6.7.2.1037/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.2.1037/main/kaniko-build.py b/linux/ecosystem/testrail/6.7.2.1037/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.2.1037/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.2.1037/main/requirements.txt b/linux/ecosystem/testrail/6.7.2.1037/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.2.1037/main/requirements.txt +++ b/linux/ecosystem/testrail/6.7.2.1037/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.2.1043/ad/Makefile b/linux/ecosystem/testrail/6.7.2.1043/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.2.1043/ad/Makefile +++ b/linux/ecosystem/testrail/6.7.2.1043/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.2.1043/ad/kaniko-build.py b/linux/ecosystem/testrail/6.7.2.1043/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.2.1043/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.2.1043/ad/requirements.txt b/linux/ecosystem/testrail/6.7.2.1043/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.2.1043/ad/requirements.txt +++ b/linux/ecosystem/testrail/6.7.2.1043/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.2.1043/ldap/Makefile b/linux/ecosystem/testrail/6.7.2.1043/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.2.1043/ldap/Makefile +++ b/linux/ecosystem/testrail/6.7.2.1043/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.2.1043/ldap/kaniko-build.py b/linux/ecosystem/testrail/6.7.2.1043/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.2.1043/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.2.1043/ldap/requirements.txt b/linux/ecosystem/testrail/6.7.2.1043/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.2.1043/ldap/requirements.txt +++ b/linux/ecosystem/testrail/6.7.2.1043/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/6.7.2.1043/main/Makefile b/linux/ecosystem/testrail/6.7.2.1043/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/6.7.2.1043/main/Makefile +++ b/linux/ecosystem/testrail/6.7.2.1043/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/6.7.2.1043/main/kaniko-build.py b/linux/ecosystem/testrail/6.7.2.1043/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/6.7.2.1043/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/6.7.2.1043/main/requirements.txt b/linux/ecosystem/testrail/6.7.2.1043/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/6.7.2.1043/main/requirements.txt +++ b/linux/ecosystem/testrail/6.7.2.1043/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.0.1057/ad/Makefile b/linux/ecosystem/testrail/7.0.0.1057/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.0.1057/ad/Makefile +++ b/linux/ecosystem/testrail/7.0.0.1057/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.0.1057/ad/kaniko-build.py b/linux/ecosystem/testrail/7.0.0.1057/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.0.1057/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.0.1057/ad/requirements.txt b/linux/ecosystem/testrail/7.0.0.1057/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.0.1057/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.0.0.1057/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.0.1057/ldap/Makefile b/linux/ecosystem/testrail/7.0.0.1057/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.0.1057/ldap/Makefile +++ b/linux/ecosystem/testrail/7.0.0.1057/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.0.1057/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.0.0.1057/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.0.1057/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.0.1057/ldap/requirements.txt b/linux/ecosystem/testrail/7.0.0.1057/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.0.1057/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.0.0.1057/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.0.1057/main/Makefile b/linux/ecosystem/testrail/7.0.0.1057/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.0.1057/main/Makefile +++ b/linux/ecosystem/testrail/7.0.0.1057/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.0.1057/main/kaniko-build.py b/linux/ecosystem/testrail/7.0.0.1057/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.0.1057/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.0.1057/main/requirements.txt b/linux/ecosystem/testrail/7.0.0.1057/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.0.1057/main/requirements.txt +++ b/linux/ecosystem/testrail/7.0.0.1057/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.1.1002/ad/Makefile b/linux/ecosystem/testrail/7.0.1.1002/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.1.1002/ad/Makefile +++ b/linux/ecosystem/testrail/7.0.1.1002/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.1.1002/ad/kaniko-build.py b/linux/ecosystem/testrail/7.0.1.1002/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.1.1002/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.1.1002/ad/requirements.txt b/linux/ecosystem/testrail/7.0.1.1002/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.1.1002/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.0.1.1002/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.1.1002/ldap/Makefile b/linux/ecosystem/testrail/7.0.1.1002/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.1.1002/ldap/Makefile +++ b/linux/ecosystem/testrail/7.0.1.1002/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.1.1002/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.0.1.1002/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.1.1002/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.1.1002/ldap/requirements.txt b/linux/ecosystem/testrail/7.0.1.1002/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.1.1002/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.0.1.1002/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.1.1002/main/Makefile b/linux/ecosystem/testrail/7.0.1.1002/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.1.1002/main/Makefile +++ b/linux/ecosystem/testrail/7.0.1.1002/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.1.1002/main/kaniko-build.py b/linux/ecosystem/testrail/7.0.1.1002/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.1.1002/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.1.1002/main/requirements.txt b/linux/ecosystem/testrail/7.0.1.1002/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.1.1002/main/requirements.txt +++ b/linux/ecosystem/testrail/7.0.1.1002/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.1.1013/ad/Makefile b/linux/ecosystem/testrail/7.0.1.1013/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.1.1013/ad/Makefile +++ b/linux/ecosystem/testrail/7.0.1.1013/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.1.1013/ad/kaniko-build.py b/linux/ecosystem/testrail/7.0.1.1013/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.1.1013/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.1.1013/ad/requirements.txt b/linux/ecosystem/testrail/7.0.1.1013/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.1.1013/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.0.1.1013/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.1.1013/ldap/Makefile b/linux/ecosystem/testrail/7.0.1.1013/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.1.1013/ldap/Makefile +++ b/linux/ecosystem/testrail/7.0.1.1013/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.1.1013/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.0.1.1013/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.1.1013/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.1.1013/ldap/requirements.txt b/linux/ecosystem/testrail/7.0.1.1013/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.1.1013/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.0.1.1013/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.1.1013/main/Makefile b/linux/ecosystem/testrail/7.0.1.1013/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.1.1013/main/Makefile +++ b/linux/ecosystem/testrail/7.0.1.1013/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.1.1013/main/kaniko-build.py b/linux/ecosystem/testrail/7.0.1.1013/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.1.1013/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.1.1013/main/requirements.txt b/linux/ecosystem/testrail/7.0.1.1013/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.1.1013/main/requirements.txt +++ b/linux/ecosystem/testrail/7.0.1.1013/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1014/ad/Makefile b/linux/ecosystem/testrail/7.0.2.1014/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1014/ad/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1014/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1014/ad/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1014/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1014/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1014/ad/requirements.txt b/linux/ecosystem/testrail/7.0.2.1014/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1014/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1014/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1014/ldap/Makefile b/linux/ecosystem/testrail/7.0.2.1014/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1014/ldap/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1014/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1014/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1014/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1014/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1014/ldap/requirements.txt b/linux/ecosystem/testrail/7.0.2.1014/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1014/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1014/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1014/main/Makefile b/linux/ecosystem/testrail/7.0.2.1014/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1014/main/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1014/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1014/main/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1014/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1014/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1014/main/requirements.txt b/linux/ecosystem/testrail/7.0.2.1014/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1014/main/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1014/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1015/ad/Makefile b/linux/ecosystem/testrail/7.0.2.1015/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1015/ad/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1015/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1015/ad/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1015/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1015/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1015/ad/requirements.txt b/linux/ecosystem/testrail/7.0.2.1015/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1015/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1015/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1015/ldap/Makefile b/linux/ecosystem/testrail/7.0.2.1015/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1015/ldap/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1015/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1015/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1015/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1015/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1015/ldap/requirements.txt b/linux/ecosystem/testrail/7.0.2.1015/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1015/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1015/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1015/main/Makefile b/linux/ecosystem/testrail/7.0.2.1015/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1015/main/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1015/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1015/main/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1015/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1015/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1015/main/requirements.txt b/linux/ecosystem/testrail/7.0.2.1015/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1015/main/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1015/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1016/ad/Makefile b/linux/ecosystem/testrail/7.0.2.1016/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1016/ad/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1016/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1016/ad/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1016/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1016/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1016/ad/requirements.txt b/linux/ecosystem/testrail/7.0.2.1016/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1016/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1016/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1016/ldap/Makefile b/linux/ecosystem/testrail/7.0.2.1016/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1016/ldap/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1016/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1016/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1016/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1016/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1016/ldap/requirements.txt b/linux/ecosystem/testrail/7.0.2.1016/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1016/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1016/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.0.2.1016/main/Makefile b/linux/ecosystem/testrail/7.0.2.1016/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.0.2.1016/main/Makefile +++ b/linux/ecosystem/testrail/7.0.2.1016/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.0.2.1016/main/kaniko-build.py b/linux/ecosystem/testrail/7.0.2.1016/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.0.2.1016/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.0.2.1016/main/requirements.txt b/linux/ecosystem/testrail/7.0.2.1016/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.0.2.1016/main/requirements.txt +++ b/linux/ecosystem/testrail/7.0.2.1016/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8079/ad/Makefile b/linux/ecosystem/testrail/7.4.1.8079/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8079/ad/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8079/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8079/ad/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8079/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8079/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8079/ad/requirements.txt b/linux/ecosystem/testrail/7.4.1.8079/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8079/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8079/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8079/ldap/Makefile b/linux/ecosystem/testrail/7.4.1.8079/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8079/ldap/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8079/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8079/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8079/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8079/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8079/ldap/requirements.txt b/linux/ecosystem/testrail/7.4.1.8079/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8079/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8079/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8079/main/Makefile b/linux/ecosystem/testrail/7.4.1.8079/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8079/main/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8079/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8079/main/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8079/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8079/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8079/main/requirements.txt b/linux/ecosystem/testrail/7.4.1.8079/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8079/main/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8079/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8091/ad/Makefile b/linux/ecosystem/testrail/7.4.1.8091/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8091/ad/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8091/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8091/ad/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8091/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8091/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8091/ad/requirements.txt b/linux/ecosystem/testrail/7.4.1.8091/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8091/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8091/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8091/ldap/Makefile b/linux/ecosystem/testrail/7.4.1.8091/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8091/ldap/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8091/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8091/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8091/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8091/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8091/ldap/requirements.txt b/linux/ecosystem/testrail/7.4.1.8091/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8091/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8091/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8091/main/Makefile b/linux/ecosystem/testrail/7.4.1.8091/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8091/main/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8091/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8091/main/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8091/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8091/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8091/main/requirements.txt b/linux/ecosystem/testrail/7.4.1.8091/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8091/main/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8091/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8092/ad/Makefile b/linux/ecosystem/testrail/7.4.1.8092/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8092/ad/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8092/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8092/ad/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8092/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8092/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8092/ad/requirements.txt b/linux/ecosystem/testrail/7.4.1.8092/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8092/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8092/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8092/ldap/Makefile b/linux/ecosystem/testrail/7.4.1.8092/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8092/ldap/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8092/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8092/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8092/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8092/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8092/ldap/requirements.txt b/linux/ecosystem/testrail/7.4.1.8092/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8092/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8092/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.4.1.8092/main/Makefile b/linux/ecosystem/testrail/7.4.1.8092/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.4.1.8092/main/Makefile +++ b/linux/ecosystem/testrail/7.4.1.8092/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.4.1.8092/main/kaniko-build.py b/linux/ecosystem/testrail/7.4.1.8092/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.4.1.8092/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.4.1.8092/main/requirements.txt b/linux/ecosystem/testrail/7.4.1.8092/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.4.1.8092/main/requirements.txt +++ b/linux/ecosystem/testrail/7.4.1.8092/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7010/ad/Makefile b/linux/ecosystem/testrail/7.5.1.7010/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7010/ad/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7010/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7010/ad/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7010/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7010/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7010/ad/requirements.txt b/linux/ecosystem/testrail/7.5.1.7010/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7010/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7010/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7010/ldap/Makefile b/linux/ecosystem/testrail/7.5.1.7010/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7010/ldap/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7010/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7010/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7010/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7010/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7010/ldap/requirements.txt b/linux/ecosystem/testrail/7.5.1.7010/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7010/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7010/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7010/main/Makefile b/linux/ecosystem/testrail/7.5.1.7010/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7010/main/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7010/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7010/main/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7010/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7010/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7010/main/requirements.txt b/linux/ecosystem/testrail/7.5.1.7010/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7010/main/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7010/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7012/ad/Makefile b/linux/ecosystem/testrail/7.5.1.7012/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7012/ad/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7012/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7012/ad/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7012/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7012/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7012/ad/requirements.txt b/linux/ecosystem/testrail/7.5.1.7012/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7012/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7012/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7012/ldap/Makefile b/linux/ecosystem/testrail/7.5.1.7012/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7012/ldap/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7012/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7012/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7012/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7012/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7012/ldap/requirements.txt b/linux/ecosystem/testrail/7.5.1.7012/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7012/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7012/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7012/main/Makefile b/linux/ecosystem/testrail/7.5.1.7012/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7012/main/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7012/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7012/main/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7012/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7012/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7012/main/requirements.txt b/linux/ecosystem/testrail/7.5.1.7012/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7012/main/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7012/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7013/ad/Makefile b/linux/ecosystem/testrail/7.5.1.7013/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7013/ad/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7013/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7013/ad/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7013/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7013/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7013/ad/requirements.txt b/linux/ecosystem/testrail/7.5.1.7013/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7013/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7013/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7013/ldap/Makefile b/linux/ecosystem/testrail/7.5.1.7013/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7013/ldap/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7013/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7013/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7013/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7013/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7013/ldap/requirements.txt b/linux/ecosystem/testrail/7.5.1.7013/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7013/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7013/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.1.7013/main/Makefile b/linux/ecosystem/testrail/7.5.1.7013/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.1.7013/main/Makefile +++ b/linux/ecosystem/testrail/7.5.1.7013/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.1.7013/main/kaniko-build.py b/linux/ecosystem/testrail/7.5.1.7013/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.1.7013/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.1.7013/main/requirements.txt b/linux/ecosystem/testrail/7.5.1.7013/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.1.7013/main/requirements.txt +++ b/linux/ecosystem/testrail/7.5.1.7013/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.2.1002/ad/Makefile b/linux/ecosystem/testrail/7.5.2.1002/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.2.1002/ad/Makefile +++ b/linux/ecosystem/testrail/7.5.2.1002/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.2.1002/ad/kaniko-build.py b/linux/ecosystem/testrail/7.5.2.1002/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.2.1002/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.2.1002/ad/requirements.txt b/linux/ecosystem/testrail/7.5.2.1002/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.2.1002/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.5.2.1002/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.2.1002/ldap/Makefile b/linux/ecosystem/testrail/7.5.2.1002/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.2.1002/ldap/Makefile +++ b/linux/ecosystem/testrail/7.5.2.1002/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.2.1002/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.5.2.1002/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.2.1002/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.2.1002/ldap/requirements.txt b/linux/ecosystem/testrail/7.5.2.1002/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.2.1002/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.5.2.1002/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.2.1002/main/Makefile b/linux/ecosystem/testrail/7.5.2.1002/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.2.1002/main/Makefile +++ b/linux/ecosystem/testrail/7.5.2.1002/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.2.1002/main/kaniko-build.py b/linux/ecosystem/testrail/7.5.2.1002/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.2.1002/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.2.1002/main/requirements.txt b/linux/ecosystem/testrail/7.5.2.1002/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.2.1002/main/requirements.txt +++ b/linux/ecosystem/testrail/7.5.2.1002/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.3.1000/ad/Makefile b/linux/ecosystem/testrail/7.5.3.1000/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.3.1000/ad/Makefile +++ b/linux/ecosystem/testrail/7.5.3.1000/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.3.1000/ad/kaniko-build.py b/linux/ecosystem/testrail/7.5.3.1000/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.3.1000/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.3.1000/ad/requirements.txt b/linux/ecosystem/testrail/7.5.3.1000/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.3.1000/ad/requirements.txt +++ b/linux/ecosystem/testrail/7.5.3.1000/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.3.1000/ldap/Makefile b/linux/ecosystem/testrail/7.5.3.1000/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.3.1000/ldap/Makefile +++ b/linux/ecosystem/testrail/7.5.3.1000/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.3.1000/ldap/kaniko-build.py b/linux/ecosystem/testrail/7.5.3.1000/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.3.1000/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.3.1000/ldap/requirements.txt b/linux/ecosystem/testrail/7.5.3.1000/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.3.1000/ldap/requirements.txt +++ b/linux/ecosystem/testrail/7.5.3.1000/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/7.5.3.1000/main/Makefile b/linux/ecosystem/testrail/7.5.3.1000/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/7.5.3.1000/main/Makefile +++ b/linux/ecosystem/testrail/7.5.3.1000/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/7.5.3.1000/main/kaniko-build.py b/linux/ecosystem/testrail/7.5.3.1000/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/7.5.3.1000/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/7.5.3.1000/main/requirements.txt b/linux/ecosystem/testrail/7.5.3.1000/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/7.5.3.1000/main/requirements.txt +++ b/linux/ecosystem/testrail/7.5.3.1000/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/8.0.0.1089/ad/Makefile b/linux/ecosystem/testrail/8.0.0.1089/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/8.0.0.1089/ad/Makefile +++ b/linux/ecosystem/testrail/8.0.0.1089/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/8.0.0.1089/ad/kaniko-build.py b/linux/ecosystem/testrail/8.0.0.1089/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/8.0.0.1089/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/8.0.0.1089/ad/requirements.txt b/linux/ecosystem/testrail/8.0.0.1089/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/8.0.0.1089/ad/requirements.txt +++ b/linux/ecosystem/testrail/8.0.0.1089/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/8.0.0.1089/ldap/Makefile b/linux/ecosystem/testrail/8.0.0.1089/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/8.0.0.1089/ldap/Makefile +++ b/linux/ecosystem/testrail/8.0.0.1089/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/8.0.0.1089/ldap/kaniko-build.py b/linux/ecosystem/testrail/8.0.0.1089/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/8.0.0.1089/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/8.0.0.1089/ldap/requirements.txt b/linux/ecosystem/testrail/8.0.0.1089/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/8.0.0.1089/ldap/requirements.txt +++ b/linux/ecosystem/testrail/8.0.0.1089/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/8.0.0.1089/main/Makefile b/linux/ecosystem/testrail/8.0.0.1089/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/8.0.0.1089/main/Makefile +++ b/linux/ecosystem/testrail/8.0.0.1089/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/8.0.0.1089/main/kaniko-build.py b/linux/ecosystem/testrail/8.0.0.1089/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/8.0.0.1089/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/8.0.0.1089/main/requirements.txt b/linux/ecosystem/testrail/8.0.0.1089/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/8.0.0.1089/main/requirements.txt +++ b/linux/ecosystem/testrail/8.0.0.1089/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/8.0.1.1029/ad/Makefile b/linux/ecosystem/testrail/8.0.1.1029/ad/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/8.0.1.1029/ad/Makefile +++ b/linux/ecosystem/testrail/8.0.1.1029/ad/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/8.0.1.1029/ad/kaniko-build.py b/linux/ecosystem/testrail/8.0.1.1029/ad/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/8.0.1.1029/ad/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/8.0.1.1029/ad/requirements.txt b/linux/ecosystem/testrail/8.0.1.1029/ad/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/8.0.1.1029/ad/requirements.txt +++ b/linux/ecosystem/testrail/8.0.1.1029/ad/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/8.0.1.1029/ldap/Makefile b/linux/ecosystem/testrail/8.0.1.1029/ldap/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/8.0.1.1029/ldap/Makefile +++ b/linux/ecosystem/testrail/8.0.1.1029/ldap/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/8.0.1.1029/ldap/kaniko-build.py b/linux/ecosystem/testrail/8.0.1.1029/ldap/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/8.0.1.1029/ldap/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/8.0.1.1029/ldap/requirements.txt b/linux/ecosystem/testrail/8.0.1.1029/ldap/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/8.0.1.1029/ldap/requirements.txt +++ b/linux/ecosystem/testrail/8.0.1.1029/ldap/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/testrail/8.0.1.1029/main/Makefile b/linux/ecosystem/testrail/8.0.1.1029/main/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/testrail/8.0.1.1029/main/Makefile +++ b/linux/ecosystem/testrail/8.0.1.1029/main/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/testrail/8.0.1.1029/main/kaniko-build.py b/linux/ecosystem/testrail/8.0.1.1029/main/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/testrail/8.0.1.1029/main/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/testrail/8.0.1.1029/main/requirements.txt b/linux/ecosystem/testrail/8.0.1.1029/main/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/testrail/8.0.1.1029/main/requirements.txt +++ b/linux/ecosystem/testrail/8.0.1.1029/main/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/torrserver/Makefile b/linux/ecosystem/torrserver/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/torrserver/Makefile +++ b/linux/ecosystem/torrserver/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/torrserver/kaniko-build.py b/linux/ecosystem/torrserver/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/torrserver/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/torrserver/requirements.txt b/linux/ecosystem/torrserver/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/torrserver/requirements.txt +++ b/linux/ecosystem/torrserver/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/torrust-index/Makefile b/linux/ecosystem/torrust-index/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/torrust-index/Makefile +++ b/linux/ecosystem/torrust-index/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/torrust-index/kaniko-build.py b/linux/ecosystem/torrust-index/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/torrust-index/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/torrust-index/requirements.txt b/linux/ecosystem/torrust-index/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/torrust-index/requirements.txt +++ b/linux/ecosystem/torrust-index/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/torrust-tracker/Makefile b/linux/ecosystem/torrust-tracker/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/torrust-tracker/Makefile +++ b/linux/ecosystem/torrust-tracker/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/torrust-tracker/kaniko-build.py b/linux/ecosystem/torrust-tracker/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/torrust-tracker/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/torrust-tracker/requirements.txt b/linux/ecosystem/torrust-tracker/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/torrust-tracker/requirements.txt +++ b/linux/ecosystem/torrust-tracker/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper diff --git a/linux/ecosystem/vk2discord/Makefile b/linux/ecosystem/vk2discord/Makefile index 3383c9699..5e0d54db0 100644 --- a/linux/ecosystem/vk2discord/Makefile +++ b/linux/ecosystem/vk2discord/Makefile @@ -9,7 +9,7 @@ app: build: make pip - python3 kaniko-build.py --version + kaniko-wrapper --version dry: make dry-run @@ -18,7 +18,7 @@ test: make dry-run dry-run: - python3 kaniko-build.py --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run + kaniko-wrapper --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug --dry-run pip: rm -rf /usr/lib/python3.6/EXTERNALLY-MANAGED @@ -37,7 +37,7 @@ build-compose: deploy: make pip - python3 kaniko-build.py --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug + kaniko-wrapper --deploy --kaniko-image gcr.io/kaniko-project/executor:v1.23.2-debug deploy-compose: docker-compose push diff --git a/linux/ecosystem/vk2discord/kaniko-build.py b/linux/ecosystem/vk2discord/kaniko-build.py deleted file mode 100644 index e693b5c17..000000000 --- a/linux/ecosystem/vk2discord/kaniko-build.py +++ /dev/null @@ -1,196 +0,0 @@ -import os -import shutil -import argparse -import yaml -import subprocess -from collections import defaultdict -from concurrent.futures import ThreadPoolExecutor, as_completed -from dotenv import load_dotenv -import logging -import sys - -# Script version -SCRIPT_VERSION = "1.0.1.0" - -# ASCII art for EpicMorg -ASCII_ART = r""" -+=================================================+ -| ____| _) \ | | -| __| __ \ | __| |\/ | _ \ __| _` | | -| | | | | ( | | ( | | ( | | -|_____| .__/ _| \___| _| _| \___/ _| \__, | | -| | / _| _) | |___/ | -| ' / _` | __ \ | | / _ \ | -| . \ ( | | | | < ( | | -|_|\_\ \__,_| _| _| _| _|\_\ \___/ | -|\ \ / | -| \ \ \ / __| _` | __ \ __ \ _ \ __|| -| \ \ \ / | ( | | | | | __/ | | -| \_/\_/ _| \__,_| .__/ .__/ \___| _| | -| _| _| | -+=================================================+ -""" - -# Load environment variables from .env file -load_dotenv() - -def setup_logging(): - logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') - -def parse_args(): - parser = argparse.ArgumentParser(description="EpicMorg: Kaniko-Compose Wrapper", add_help=False) - parser.add_argument('--compose-file', default=os.getenv('COMPOSE_FILE', 'docker-compose.yml'), help='Path to docker-compose.yml file') - parser.add_argument('--kaniko-image', default=os.getenv('KANIKO_IMAGE', 'gcr.io/kaniko-project/executor:latest'), help='Kaniko executor image') - parser.add_argument('--push', '--deploy', '-d', '-p', action='store_true', help='Deploy the built images to the registry') - parser.add_argument('--dry-run', '--dry', action='store_true', help='Dry run: build images without pushing and with cleanup') - parser.add_argument('--version', '-v', action='store_true', help='Show script version') - parser.add_argument('--help', '-h', action='store_true', help='Show this help message and exit') - return parser.parse_args() - -def load_compose_file(file_path): - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def build_with_kaniko(service_name, build_context, dockerfile, image_name, build_args, kaniko_image, deploy, dry): - kaniko_command = [ - 'docker', 'run', - '--rm', - '-t', - '-v', f'{os.path.abspath(build_context)}:/workspace', - ] - - # Add Docker config mounts for both read-only access - kaniko_command.extend([ - '-v', '/var/run/docker.sock:/var/run/docker.sock:ro', # Access to Docker daemon - '-v', f'{os.path.expanduser("~")}/.docker:/kaniko/.docker:ro', # Use existing Docker credentials in read-only mode - ]) - - kaniko_command.extend([ - kaniko_image, - '--context', '/workspace', - '--dockerfile', f'/workspace/{dockerfile}', - '--compressed-caching', - '--single-snapshot', - '--cleanup' - ]) - - if deploy: - kaniko_command.extend([ - '--destination', image_name - ]) - elif dry: - kaniko_command.extend([ - '--no-push' - ]) - else: - kaniko_command.extend([ - '--no-push' - ]) - - # Add build arguments if they exist - for arg_name, arg_value in build_args.items(): - kaniko_command.extend(['--build-arg', f'{arg_name}={arg_value}']) - - logging.info(f"Building {service_name} with Kaniko: {' '.join(kaniko_command)}") - - process = subprocess.Popen(kaniko_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - - # Stream output in real-time - for line in process.stdout: - logging.info(line.strip()) - - process.wait() - - if process.returncode == 0: - logging.info(f"Successfully built {service_name}") - else: - for line in process.stderr: - logging.error(line.strip()) - logging.error(f"Error building {service_name}") - raise Exception(f"Failed to build {service_name}") - -def show_help(): - print(ASCII_ART) - print("EpicMorg: Kaniko-Compose Wrapper\n") - print("Arguments:") - print("--compose-file Path to docker-compose.yml file") - print("--kaniko-image Kaniko executor image") - print("--push, --deploy, -d, -p Deploy the built images to the registry") - print("--dry-run, --dry Dry run: build images without pushing and with cleanup") - print("--version, -v Show script version") - print("--help, -h Show this help message and exit") - -def show_version(): - print(ASCII_ART) - print(f"EpicMorg: Kaniko-Compose Wrapper {SCRIPT_VERSION}, Python: {sys.version}") - -def main(): - setup_logging() - - args = parse_args() - - # Show help and exit if --help is provided - if args.help: - show_help() - return - - # Show version and exit if --version or no relevant arguments are provided - if args.version or not (args.push or args.dry_run or args.compose_file != 'docker-compose.yml' or args.kaniko_image != 'gcr.io/kaniko-project/executor:latest'): - show_version() - return - - compose_file = args.compose_file - kaniko_image = args.kaniko_image - deploy = args.push - dry = args.dry_run - - if not os.path.exists(compose_file): - logging.error(f"{compose_file} not found") - return - - compose_data = load_compose_file(compose_file) - - services = compose_data.get('services', {}) - image_names = defaultdict(int) - - for service_name, service_data in services.items(): - image_name = service_data.get('image') - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - image_names[image_name] += 1 - - for image_name, count in image_names.items(): - if count > 1: - logging.error(f"Error: Image name {image_name} is used {count} times.") - return - - try: - with ThreadPoolExecutor() as executor: - futures = [] - for service_name, service_data in services.items(): - build_data = service_data.get('build', {}) - build_context = build_data.get('context', '.') - dockerfile = build_data.get('dockerfile', 'Dockerfile') - image_name = service_data.get('image') - build_args = build_data.get('args', {}) - - # Substitute environment variables with their values if they exist - build_args = {key: os.getenv(key, value) for key, value in build_args.items()} - - if not image_name: - logging.warning(f"No image specified for service {service_name}") - continue - - 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): - future.result() - except Exception as exc: - logging.error(f"Build failed: {exc}") - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/linux/ecosystem/vk2discord/requirements.txt b/linux/ecosystem/vk2discord/requirements.txt index 9ed771861..568608d59 100644 --- a/linux/ecosystem/vk2discord/requirements.txt +++ b/linux/ecosystem/vk2discord/requirements.txt @@ -1,2 +1,3 @@ PyYAML python-dotenv +kaniko-wrapper